Home / Admin / Noindex Product Search Pages
Duplicate Snippet

Embed Snippet on Your Site

Noindex Product Search Pages

This code snippet can be used to set noindex on WooCommerce product search pages.

200+
Code Preview
php
<?php
add_filter( 'aioseo_robots_meta', 'aioseo_filter_robots_meta' );
function aioseo_filter_robots_meta( $attributes ) {
	if ( is_search() && 'product' === get_query_var('post_type') ) {
		$attributes['index'] = "noindex";
	};
	return $attributes;
}

Comments

Add a Comment