Noindex Empty Categories, Tags or Custom Taxonomies (for Yoast SEO Plugin Users)

In one of my project, I was using “Query Multiple Taxonomies” plugin. After a few days, I noticed that Google Search Console was showing 400% more valid pages. That was huge!

When I dug up, I found that they were empty pages created by that plugin. It’s like querying taxonomyA&taxonomyB to find any post. So I decided to noindex those empty pages.

I saw in a forum, someone was seeking same help describing “We have followers, following, friends, etc pages for each user who creates account on our website. so when new user sign up, he may have 0 followers, 0 following and 0 friends, but over period of time he can get those lists go up. we have different pages for followers, following and friends which are allowed for google to index. How to noindex when there is no data on those pages?”

I saw another person was asking “Is it good or bad to add noindex for empty pages, which will get content dynamically after some days”.

John Mueller of Google said it doesn’t really matter.

Then I figured out following solution to add in functions.php file.

add_filter('wpseo_robots', 'yoast_my_noindex', 999);
function yoast_my_noindex($string= "") {
	if ( have_posts() == false ){$string= "noindex, follow";}
	return $string;
Spread the love

A teacher by profession, a traveler by passion and a netizen by choice.

Morshed Alam

You use WordPress! Why don't we share our experience! It may be a tutorial, tips, tricks or about security, performance or WordPress news. Write Today

2 thoughts on “Noindex Empty Categories, Tags or Custom Taxonomies (for Yoast SEO Plugin Users)”

Leave a Comment

Your email address will not be published. Required fields are marked *