[AIOSEOP] How to NOINDEX the search results page

Plugin : WordPress AIOSEOP (All in one SEO Pack)

Version : 2.0.2

Website’s plugin : Michael Torbert of Semper Fi Web Design

Problem : No meta noindex on the search results pages

Object to tweak : Search results page

Any users AIOSEOP noticed that there’s no feature on this plugin to create a meta robot noindex for search results page?

Because it would be a problem since search engine (Google’s webmaster tool would detect them) will index the search. Duplicate title or description will accidentally occurred. We won’t let this happened, right.

The solution is quite simple. Again we should open wp-content/plugins/all-in-one-seo-pack/aioseop_class.php file. As I said on the other article, this is the file where the most of AIOSEOP’s configuration are set.

How to make a noindex meta tag to the search pages as addition to AIOSEOP’s generated header tag?

Let’s take a look at the line of 1081 :

if ( ( is_category() && $aioseop_options['aiosp_category_noindex'] ) || ( !is_category() && is_archive() &&!$is_tag && $aioseop_options['aiosp_archive_noindex'] ) || ( $aioseop_options['aiosp_tags_noindex'] && $is_tag ) {
 $meta_string .= '<meta name="robots" content="noindex,follow" />' . "\n";

Add is_single() to the codes, so it would be like this

if ( ( is_category() && $aioseop_options['aiosp_category_noindex'] ) || ( !is_category() && is_archive() &&!$is_tag && $aioseop_options['aiosp_archive_noindex'] ) || ( $aioseop_options['aiosp_tags_noindex'] && $is_tag || is_search()) ) {
 $meta_string .= '<meta name="robots" content="noindex,follow" />' . "\n";

Simple isn’t it? Just make a test, you’ll see this on a source code of result pages.

<meta name="robots" content="noindex,follow" />

About

Used to be a developer and designer. But now I manage a skincare site and sell them through online market. But still enthusiast to learn the codes

[AIOSEOP] How to NOINDEX the search results page
2 votes, 4.50 avg. rating (91% score)

Leave a Reply

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

+ 35 = 38

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>