Home / Admin / Noindex Products under a Product Category
Duplicate Snippet

Embed Snippet on Your Site

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.

100+
Code Preview
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;
}

Comments

Add a Comment