• Resolved silvo37

    (@silvo37)


    Hello,

    Is there a way how can we add noindex nofollow to woocommerce filters?
    For example filters for attributes size and color.

    Thank you.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support J Burns

    (@subiewrx)

    Hi @silvo37,

    You could modify the following filter to add noindex, nofollow to your products that contain attributes – https://aioseo.com/docs/aioseo_robots_meta/

    Please let me know if you have any other questions.

    Thanks!

    Thread Starter silvo37

    (@silvo37)

    Thank you J Burns,
    Would it be possible to help me out with filter example which adds noindex to for example size attribute?

    Thank you very much!

    Plugin Support Shivam Tyagi

    (@shivamtyagi)

    Hi @silvo37,

    Here’s an example code snippet-

    
    add_filter( 'aioseo_robots_meta', 'aioseo_filter_robots_meta' );
    function aioseo_filter_robots_meta( $attributes ) {
    	if ( ! function_exists( 'is_shop' ) ) {
    		return $attributes;
    	}
    	
    	if ( is_shop() && ( isset( $_GET['filter_color'] ) || isset( $_GET['filter_size'] ) ) ) {
    		$attributes['noindex']  = 'noindex';
    		$attributes['nofollow'] = 'nofollow';
    	}
    
    	return $attributes;
    }
    
    Thread Starter silvo37

    (@silvo37)

    Thank for your help but it seems the code above doesnt help and attribute filter are still indexed.
    I add following code which includes 2 attributes – Drop and Size (velikost)

    add_filter( 'aioseo_robots_meta', 'aioseo_filter_robots_meta' );
    function aioseo_filter_robots_meta( $attributes ) {
    	if ( ! function_exists( 'is_shop' ) ) {
    		return $attributes;
    	}
    	
    	if ( is_shop() && ( isset( $_GET['filter_drop'] ) || isset( $_GET['filter_velikost'] ) ) ) {
    		$attributes['noindex']  = 'noindex';
    		$attributes['nofollow'] = 'nofollow';
    	}
    
    	return $attributes;
    }

    Could you pls help me why this doesnt work?

    Thank you very much!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Noindex, no follow to woocommerce filter’ is closed to new replies.