Can i read/write values like focus keyword or meta title via API / http request?

#915505
Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello,

    Thank you for contacting support.

    We don’t have any API calls that you can use for this purpose but since we save the data in custom fields on the database you can update the following fields using the WP REST API calls:

    
    rank_math_focus_keyword
    rank_math_title
    rank_math_description
    

    It’s important to note that 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/

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

    appert
    Rank Math free

    That works.

    appert
    Rank Math free

    Actually, it used to work today in the morning and for some strange reason, now I’m getting the following error:

    “Sorry, you are not allowed to edit the rank_math_focus_keyword custom field.”

    All I did today was adding content, so it’s really weird, that I cannot update those fields anymore…

    Hello,

    It looks like the custom fields might not be registered correctly. You’ll need to ensure that the meta fields (rank_math_title and rank_math_description) are registered for the REST API using register_meta() in your theme or plugin. Here’s a quick reference: https://developer.wordpress.org/reference/functions/register_meta/

    After registering, your REST API call should work as expected.

    Let us know how that goes. Looking forward to helping you.

    Now for some reason, rank math is not saving any focus keyword anymore. -> Oh now i see: When i create a meta field with crocoblock, rank math is not able to save the focus keyword.

    Hello,

    Please check if you are using a Firewall as it may prevent saving the changes.

    If you are using a Firewall, please whitelist this route:

    /wp-json/rankmath/v1/updateMeta

    You can check this link for more information:
    https://rankmath.com/kb/meta-data-not-saving/

    Let us know how this goes.

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this ticket.