Home
/
Admin
/
Noindex Products under a Product Category
Use Snippet
Add to Library
Share Snippet
Embed Snippet
Duplicate Snippet
Embed Snippet on Your Site
Copy
Noindex Products under a Product Category
This code snippet can be used to set noindex on all the Products under a Product Category.
Please make sure to replace CategoryName with the name of your Product Category.
php <?php
add_filter( 'aioseo_robots_meta' , 'aioseo_filter_robots_meta' );
function aioseo_filter_robots_meta ( $attributes ) {
if ( has_term( 'CategoryName' , 'product_cat' ) ) {
$attributes['noindex' ] = 'noindex' ;
}
return $attributes;
}
Other Snippets by Author
This snippet will find new images inside the post content, which has Elementor Galleries. And it…
This snippet searches for a specific string in the current URL and if found, it set…
This filter limits the Meta Description to 160 characters throughout the website
This filter limits the SEO Title length to 60 characters throughout the website
This code snippet recreates the missing 'aioseo_cache' table. This code snippet should be enabled and executed…
This code snippet will disable AIOSEO autogenerated shipping details schema for WooCommerce Products
Prev
Next
Comments