Noindex on category pages

#83169
  • Resolved Michael
    Rank Math free

    Hi there,

    I have recently began to start writing blogs on my website. I have written a couple and put categories on them (Search Engine Optimization, SEO, Onpage, Offpage, etc). My question is how do I noindex these pages?

    I saw an option for noindex empty category, but I believe that is not the correct option. These category pages have also become orphan pages + missing meta descriptions.

    I would like to keep categories but not have them indexed. I hope my explanation helps.

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math today.

    To noindex the categories, just head to the individual categories and set them to noindex in Rank math metabox under the Advanced tab.
    imgg

    We however do not have an option to bulk noindex the pages within a category if that’s your intention. As a work around you can customize the following filter and add it to your theme functions.php file to add the noindex tag to the specified pages:

    /**
     * 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 category
         if(get_category() == "your_category_name_here"){
            $robots['index'] = "noindex";
            $robots['follow'] = "follow";
            return $robots;
         }
    	return $robots;
    });
    

    Looking forward to helping you. Thank you.

    ​​​​​​

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘Noindex on category pages’ is closed to new replies.