BULK index noindex

#55563
  • Resolved Karanadiksha
    Rank Math free

    Hi,
    I need to bulk change a lot of posts from noindex to index…. there is some way to do it easy?
    Maybe if you tell me were is stored the noindex…. something like:
    <?php update_post_meta( $post_id = 76, $key = ‘my_key’, $value = ‘Steve’ ); ?>
    Thanks

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

    Thank you for contacting Rank Math today.

    Unfortunately Rank math doesn’t have a feature to change bulk index noindexed posts. Even though you can toggle the index from the Rank Math > Titles & Meta page, these settings will only take effect when creating new posts.

    To workaround this, you can make use of a filter to set all the posts on the post type to index/follow like so:

    /**
     * Allows filtering of the robots meta data.
     *
     * @param array $robots The meta robots directives.
     */
    add_filter( 'rank_math/frontend/robots', function( $robots ) {
         global $post;
         // filter for only a specific post type
         if(get_post_type() == "your_post_type_name_here"){
            $robots['index'] = "index";
            return $robots;
         }
    	return $robots;
    });

    Looking forward to helping you. Thank you.

    ​​​​​​

    Hi,
    I think I can work with this function
    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/#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 3 replies - 1 through 3 (of 3 total)

The ticket ‘BULK index noindex’ is closed to new replies.