How to chance the no index all the posts

#30046
  • Resolved Joan
    Rank Math free

    how to change the noindex to more than 1300 posts at once with reank math?
    Each of the posts has the noindex labeled.
    Does it have to be done by editing the database?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hello,

    Thank you for contacting Rank Math today.

    I can suggest that you dynamically apply the noindex option by writing some code to target the 1300 posts by using the following filter:

    /**
     * Allows filtering of the robots meta data.
     *
     * @param array $robots The meta robots directives.
     */
    add_filter( 'rank_math/frontend/robots', function( $robots ) {
    	return $robots;
    });

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Joan
    Rank Math free

    Hello,
    The problem is I have 1300 posts tagged noindex, if I go into every post… it’s marked as non-index.

    I already checked the general configuration of the plugin and it’s fine. It’s every post that is marked as noindex.

    What I want is to put them all at once as index and be able, in the future, to configure some of them personally ennoindex (with the plugin)

    HI Joan,

    Thanks for the reply.

    You can head over to Rank Math > Titles & Meta settings page and set the post type robots meta to index but this will only affect new posts. The 1300 posts will have to be resaved for these settings to take effect.

    To automatically set the robots meta to index, you will need to use the filter I suggested earlier.

    I hope this info helps. Thank you.

    Joan
    Rank Math free

    ok
    the filter you passed, where do I write it? in the functions.php

    thanks

    Hi Joan,

    Thanks for getting back to me.

    Yes you should add this code to your theme’s functions.php file. It will however need some additional logic to check the current post and if it matches the post type then set the $robots['index'] = 'noindex';

    I hope this info helps. Thank you.

    Joan
    Rank Math free

    Can’t you throw a SQL statement to change the status of all the posts?

    Because applying the filter works but for example the sitemaps.xml does not show the posts since in the database they are marked as noindex.

    thanks

    Joan
    Rank Math free

    Can a SQL statement be launched to change the status of all posts?

    Because applying the filter works but for example the sitemaps.xml does not show the posts since in the database they are marked as noindex.

    thanks

    Todd
    Rank Math free

    Hi Joan,

    Thank you for your patience.

    Did you import SEO data from any other SEO plugin? It is possible that the noindex information from transferred from old SEO plugin if you imported the data.

    Also, have you already trying deselecting all checkboxes in WordPress Dashboard > Rank Math > Titles & Meta > Posts.

    You can use this DB Query to do so as well:
    UPDATE wp_postmeta SET meta_value='a:1:{i:0;s:5:"index";}' WHERE meta_key='rank_math_robots'

    You might need to change wp_ prefix in the wp_postmeta table name.

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Joan
    Rank Math free

    Yes, thank you very much.
    amount of all in one SEO

    Those people are playing dirty and can’t stand that rank math is the best SEO plugin in the world 😉

    Today they apply me the update in the database and I keep them up to date.

    Again, thanks

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/?rate=5#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

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

The ticket ‘How to chance the no index all the posts’ is closed to new replies.