• Resolved Dexter0015

    (@improvedline)


    Hi,

    For a project, I need to update some of the website contents that match specific conditions.

    I already developped a plugin which execute a cron task every day to do just that.
    Now I need to perform some additionnal tasks.

    The idea is to disable specific contents if some conditions are matched.
    As thoses contents may be indexed, I would like to do it intelligently to avoid reuining the SEO efforts.

    That I would like to do, is the following:

    • switching the content to a different status, like “private” for example (this part should not be a problem)
    • updating SEO parameters for the contents that needs to no be accessible anymore

    My initiale idea was to create a redirection but as i saw in your documention/forum, RankMath only provide a global setting for redirection linked to 404 pages.

    So my current idea would be to switch the content to “no-index”.

    I saw that Rank Math provide routes in the Rest API, specifically this one:

    /rankmath/v1/updateMeta

    Which I should be able to call from my plugin using Wp’s rest_do_request() method.
    https://developer.www.ads-software.com/reference/functions/rest_do_request/

    My question is regarding the usage of the route, the documentation of the route doesn’t describe how to implement the third parameter “meta”, so I would like to know if the following structure for the request body is correct:

    {
        "objectType": <my-post-type>,
        "objectID": <my-post-id>,
        "meta": {
            "rank_math_robots" : ["no-index"]
        }
    }

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Update post to no-index using the rest api’ is closed to new replies.