Noindex Woocommerce Attributes ?

  • Hello,
    how can i set the attributes archive pages to noindex ???

    Also i have a problem that product attribute archive pages like this

    redirect to my homepage

    I don’t have these archives 100%! Disabled all, but they can be typed in and redirected to the frontpage.

    b. regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • hi,
    i found the problem of the redirect. it was an related post plugin who does that redirect.

    However how can i set all Woocommerce attributes pages to noindex ?
    If i add new products, new attributes are added which get fast indexed by google.

    I want them all on noindex.

    b. regards


    Thank you for contacting Rank Math today.

    I am glad that you were able to fix the redirection issue. In regards to the other issue, you can set the product attributes to noindex by doing the following:

    1). Create a custom function to check product attribute pages as shown below:

    function custom_is_wc_attribute() {
        if ( is_tax() && function_exists( 'taxonomy_is_product_attribute') ) { 
            // now we know for sure that the queried object is a taxonomy
            $tax_obj = get_queried_object();
            return taxonomy_is_product_attribute( $tax_obj->taxonomy );
        return false;

    2). Add the following code to set these pages to noindex:

     * Modify Rank Math robots meta data.
     * Targeting product attribute pages
     * @param array $robots The meta robots directives.
    add_filter( 'rank_math/frontend/robots', function( $robots ) {
               $robots['index'] = 'noindex';
               return $robots;
    	return $robots;

    Both of these snippets should be added to your theme’s functions.php file.

    Looking forward to helping you. Thank you.


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

You must be logged in to reply to this ticket.