Unable to Update Meta Title/Description via REST API

#1054184
  • Resolved NAFISUL ISLAM
    Rank Math free

    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.

Viewing 1 replies (of 1 total)
  • Hello,

    I apologize for the issue you are facing with updating the Rank Math meta title and description via the REST API. It sounds like you’ve already done a thorough job troubleshooting the common issues.

    Here are a few additional steps you can take to resolve this problem:

    1. Check Firewall Settings: Ensure that your firewall settings are not blocking the REST API requests. If you are using a security plugin or service like Cloudflare, make sure to whitelist the necessary Rank Math REST API endpoints. You can refer to our guide on whitelisting Rank Math in Cloudflare for detailed instructions.

    2. Verify API Endpoint: Make sure you are using the correct endpoint for updating meta data. The correct endpoint for updating meta fields is typically /wp-json/rankmath/v1/updateMeta. Ensure that your payload is being sent to this endpoint after creating the post or page.

    3. Check for Errors in Response: After sending your POST request, check if there are any error messages returned in the response that might indicate what went wrong.

    4. Review Rank Math Settings: Double-check that the "Headless CMS Support" option is indeed enabled in the Rank Math settings. Sometimes, settings may not save correctly, so it’s worth verifying.

    5. Debugging: Enable debugging in WordPress to see if any errors are logged when you attempt to update the meta fields. You can do this by adding define( 'WP_DEBUG', true ); and define( 'WP_DEBUG_LOG', true ); to your wp-config.php file.

    If you continue to experience issues after trying these steps, please reply to this ticket with your site URL, and a human agent from our support team will be able to assist you further. Thank you for raising this concern, and we appreciate your patience as we work to resolve it!

    Sources:
    How to Enable Headless CMS Support in Rank Math? » Rank Math
    Why Your SEO Title, Description & Focus Keyword Aren’t Being Saved » Rank Math

    This is an automated reply from Rank Math Support Bot. If you need further assistance, please reply to this topic and a human support agent will reply to you shortly.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘Unable to Update Meta Title/Description via REST API’ is closed to new replies.