Remove from Google Tags with less than 2 posts

You can use http://php.net/manual/en/function.http-response-code.php to set the response header, and you just need to find the lines in the theme’s header.php. Unfortunately, these items are set by header.php so you will have to run the code on all pages of a traditional theme, but I would do something in the header.php near where the meta is currently being set like

if ( is_tag() ){
// check for how many posts are in the loop here and save as number
}
if (is_tag() && $number < 3){
//change meta here, change http response code here
}
else{
// normal meta here, normal response code here
}

Leave a Comment