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 any URL that has the 'product_search=' attribute.
<10
Code Preview
php
<?php
add_filter( 'aioseo_robots_meta', 'aioseo_filter_robots_meta' );
function aioseo_filter_robots_meta( $attributes ) {
	$url = home_url( $_SERVER['REQUEST_URI'] );
	if (strpos($url,'product_search=') !== false) {
		$attributes['index'] = "noindex";
	};
	return $attributes;
}

Comments

Add a Comment