noindex on bulk categories

#157260
  • Resolved Asger Svendsen
    Rank Math free

    Hi there

    I need to set noindex/nofollow on a bunch of categories with a lot of products in them. (the products needs to be noindex as well) I found a guide on how to do this with Yoast, and i was wondering if i can accomplish the same with rankmath?

    The code looks like this:

    add_filter( ‘wpseo_robots’, ‘yoast_seo_robots_remove_single’ ); //add Yoast filter for meta

    function yoast_seo_robots_remove_single( $robots ) {
    if ( is_product() && has_term(
    ‘arbejdstoej-sikkerhed’,
    ‘vaerktoej’,
    ‘tagvaerktoej’,
    ‘armering-murerartikler’,
    ‘bolte-saetskruer’,
    ‘laase-doerbeslag’,
    ‘moetrikker’, ) ) { //check for category
    return ‘noindex,nofollow’; //noindex nofollow those pages
    } else {
    return $robots; //else return normal meta
    }
    }

    I look forward to your response 🙂
    Sincerely Asger

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The ticket ‘noindex on bulk categories’ is closed to new replies.