Unable to POST change to Page keywords

#826561
Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello,

    I’m sorry to hear that you are facing issues while trying to update the keywords on your WordPress site using the Rank Math API. The error message you received indicates a permission-related problem with a status code 403 (forbidden).

    To troubleshoot this issue, you can follow these steps:

    1. Check User Permissions: Ensure that the user making the API request has the necessary permissions to update metadata using the Rank Math API. You might need to have administrative or specific capabilities to modify SEO metadata.

    2. Whitelist Rank Math API Endpoint: If you are using any security plugins like Wordfence or Cloudflare, they might be blocking access to the Rank Math API endpoint. You can whitelist the Rank Math API endpoint in your security plugin settings.

    3. Review Firewall Settings: If you have a firewall enabled, it might be blocking the API requests. Check your firewall settings to ensure that requests to the Rank Math API endpoint are allowed.

    If after checking these steps, the issue persists, I recommend reaching out to our support team by opening a support ticket here. Our support experts will assist you further in resolving this permissions-related problem.

    Thank you for bringing this to our attention, and we appreciate your patience as we work to resolve this issue for you.

    Warm regards.

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

    #2 and #3 do not apply. #1 guidance did not tell me what specifically to address permissions wise. So I am still lost trying to figure out what permissions where and how to fix.

    Please advise. Thank you.

    Hello,

    Thank you for your query and we are so sorry about the trouble this must have caused.

    From the URL you shared, it seems to be that you are setting up a GET request method as we can see the data is in the query parameter. For a POST method to work, you’ll have to pass the data via the request body.

    As for the error, please note that the Rank Math REST endpoints like wp-json/rankmath/v1/updateMeta are not user-queryable, so you will always encounter an error when trying to access them directly. Please may you clarify what you want to achieve and how are you using them.

    Looking forward to helping you.

    Thank you, Jeremy, for the timely response.

    I am using the WordPress REST API via a C# application to update content on an Azure WordPress website. I can POST changes to all sorts of content using that approach, but the Rank Math meta data is not accessible using the same methods.

    Do you have an example of how to update the Rank Math meta data using the body? Or some other approach that will accomplish the same?

    Thank you.

    Hello,

    To update the data of our plugin using the REST API you need to first register the metadata fields that you want to update and then use the WordPress REST API to update those custom fields using something similar to this: https://torquemag.io/2015/07/working-with-post-meta-data-using-the-wordpress-rest-api/

    As an example, the custom field for the focus keyword in our plugin is called rank_math_focus_keyword.

    Don’t hesitate to get in touch if you have any other questions.

    Does this edit the rank_math_focus_keyword custom field directly, or does a new field in ‘meta’ have to be created?

    Here’s where I’m at now. I…
    POST to https://www.mysite.com/wp-json/wp/v2/pages/33?rank_math_focus_keyword=cooking using PostMan.

    I get the page as an expected response, but the rank_math_focus_keyword field has not updated.

    Thank you.

    Hello,

    As we mentioned before, the update of the data needs to be done using the body of the request.

    The tutorial we shared previously explains how you can register the postmeta fields that you want to update with your request and has an example of a potential request being made to update a value in the postmeta.

    If you are not familiar with how to work with the WordPress REST API you need to consult the documentation here: https://learn.wordpress.org/tutorial/wp-rest-api-custom-fields-authentication-and-testing/

    This is not specific to our plugin, it’s an issue with how you are trying to update postmeta values which are where our plugin saves the data.

    Don’t hesitate to get in touch if you have any other questions.

    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 8 replies - 1 through 8 (of 8 total)

The ticket ‘Unable to POST change to Page keywords’ is closed to new replies.