You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Clarify supported post types and update usage examples in README.md and api-documentation.md
- Added details to specify that only posts and products are supported for the `post_id` parameter, excluding pages.
- Updated cURL examples to reflect correct usage with real post/product IDs and Application Passwords.
- Enhanced error handling documentation to include specific cases for invalid `post_id`.
Copy file name to clipboardExpand all lines: README.md
+9-4Lines changed: 9 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,9 +33,11 @@ This extension enhances the WordPress REST API with custom endpoints that allow
33
33
34
34
Updates Rank Math SEO metadata for a specific post or product.
35
35
36
+
**Supported post types:** Only **posts** (`post`) and **products** (`product`, if WooCommerce is active). Page IDs are not accepted and will return a validation error.
37
+
36
38
**Parameters:**
37
39
38
-
-`post_id` (required) - ID of the post/product
40
+
-`post_id` (required) - ID of the post or product (must be a post or product, not a page)
39
41
-`rank_math_title` (optional) - SEO title
40
42
-`rank_math_description` (optional) - SEO description
Replace `USERNAME` and `APPLICATION_PASSWORD` with your WordPress username and [Application Password](https://wordpress.org/documentation/article/application-passwords/). Use a real **post** (or product) ID; page IDs are not supported.
56
+
53
57
**Response:**
54
58
55
59
```json
@@ -381,7 +385,7 @@ A: Check that the Application Password is correctly configured and that the user
381
385
A: Verify that the plugin is active and that the WordPress REST API is available.
382
386
383
387
**Q: I get 400 Bad Request errors?**
384
-
A: Check that the `post_id` exists and that all parameters are correctly formatted.
388
+
A: Ensure `post_id` is a **post** or **product** (pages are not supported). Check that the post exists and that all parameters are correctly formatted.
385
389
386
390
**Q: WooCommerce integration doesn't work?**
387
391
A: Check that WooCommerce is installed and activated.
@@ -412,6 +416,7 @@ A: Yes, webhook support is planned for phase 3.
412
416
- Verify that the REST API is available
413
417
414
418
3.**400 Bad Request**
419
+
- Ensure `post_id` is a **post** or **product** (not a page)
415
420
- Check that `post_id` exists
416
421
- Validate that all parameters are correctly formatted
|`post_id`| integer | Yes | ID of the post or product |`123`|
73
+
|`post_id`| integer | Yes | ID of the post or product |`14`|
74
74
|`rank_math_title`| string | No | SEO title (max 60 characters) |`"How to Optimize WordPress SEO"`|
75
75
|`rank_math_description`| string | No | SEO description (max 160 characters) |`"Learn the best practices for optimizing your WordPress site for search engines"`|
76
76
|`rank_math_canonical_url`| URL | No | Canonical URL |`"https://example.com/post-url"`|
77
77
|`rank_math_focus_keyword`| string | No | Primary focus keyword |`"WordPress SEO optimization"`|
78
78
79
+
**Supported post types:** Only **posts** (`post`) and **products** (`product`, if WooCommerce is active). The `post_id` must refer to one of these. Page IDs and other post types will return `rest_invalid_param`.
80
+
79
81
#### Request Examples
80
82
81
-
##### cURL
83
+
##### Quick test (local or production)
84
+
85
+
Use a real **post** (or product) ID; page IDs are not supported. Replace the URL and credentials with your site and [Application Password](https://wordpress.org/documentation/article/application-passwords/).
86
+
87
+
```bash
88
+
# Local (e.g. Local by Flywheel)
89
+
curl -X POST "http://devora-ny.local/wp-json/rank-math-api/v1/update-meta" \
0 commit comments