how to noindex all posts in a category

#39882
  • Resolved Shege
    Rank Math free

    Hello i just switched to rankmath today from yoast and i want to noindex all the post in a particular category. this setting was not available in yoast but while searching the web i found out that they were able to solve this issue for someone else in support, they came up with a php code that solved the problem and i am hoping i can get a code that will work here.
    This is the code that worked with yoast

    add_filter( ‘wpseo_robots’, ‘wpseo_robots’ );
    /**
    * Filter: ‘wpseo_robots’ – Allows filtering of the meta robots output of Yoast SEO.
    *
    * @param string $robotsstr The meta robots directives to be echoed.
    * @return string
    */
    function wpseo_robots( $robotsstr ) {
    if ( is_single() && in_category( 1191 ) ) {
    return ‘noindex,follow’;
    }
    return $robotsstr;
    }

    Where “1191” is the category tag
    but when i swithced to rankmath the noindex tag on the post disappeared ie. the code stopped working, i will be grateful if you can come up with a solution that works for me.

    Thanks
    Warm regards

Viewing 1 replies (of 1 total)
  • Todd
    Rank Math free

    Hi,

    Thanks for getting in touch with me.

    I am sorry but that option is not available in Rank Math. You can noindex the category itself but not the posts inside. You will have to do it manually.

    With that being said, there are existing feature requests, so I’ve added your vote to our internal suggestions lists. If your suggestions are something that we’re able to introduce, I’ll be sure to let you know.

    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 ‘how to noindex all posts in a category’ is closed to new replies.