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

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

empty

In one of my projects, I was using the “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 them 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 the following solution to add to the 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;
}

Read more from Tutorial

Written by:

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

Have you written on ThoughtMight?Write Today



Leave a Comment

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