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.
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