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

#915505
Viewing 4 replies - 1 through 4 (of 4 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.

    That works.

    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.

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

You must be logged in to reply to this ticket.