-
Hello
I am using the WordPress REST API to programmatically create posts and pages on my site, but I am unable to set the Rank Math meta title and description.The Goal: I am sending a POST request to the /wp/v2/pages or /wp-json/wp/v2/posts endpoints. The JSON payload correctly includes a meta object with the Rank Math fields.
Here is an example of the payload my script is sending:
JSON
{
“title”: “My Awesome Article Title”,
“content”: “<p>This is the article content.</p>”,
“status”: “publish”,
“meta”: {
“rank_math_title”: “My SEO Title for Rank Math”,
“rank_math_description”: “My SEO description for Rank Math.”
}
}The Problem: The page or post gets created successfully (I receive a 201 Created response), but the Rank Math meta fields are always ignored. When I check the created post in the WordPress editor, the Yoast/Rank Math fields are blank. A subsequent GET request to the API for that new post also confirms the Rank Math meta fields are empty.
Troubleshooting Steps Already Taken: This is not a simple issue. I have already performed extensive troubleshooting to rule out common problems:
The user making the API call has an Administrator role.
The “Headless CMS Support” option in Rank Math’s Global Meta settings is enabled.
I have tested with all other plugins deactivated (except for Rank Math). The issue still occurs.
I have tested with a default WordPress theme (like Twenty Twenty-Four). The issue still occurs.
I have contacted my hosting provider, and they have investigated and adjusted their server security (ModSecurity) rules. The issue still occurs.My Question: Since we have ruled out user permissions, plugin/theme conflicts, and server firewalls, could you please help me understand what else could be preventing an authenticated Administrator from updating the rank_math_title and rank_math_description fields via the REST API?
Is there another setting, a known incompatibility with certain server environments, or a specific way the API request needs to be formatted that is not in the public documentation?
Thank you for your time and assistance.
The ticket ‘Unable to Update Meta Title/Description via REST API’ is closed to new replies.