+91-943-185-6038 me@shashidharkumar.com
WordPress auto generates a lot of low value pages like the search results pages (generated if you use the WordPress search feature), the 404 error pages which are generated in-case of requests to non-existent pages and archive pages that have links to your blog posts categorized into date (yearly, monthly and daily), authors, tags and categories. Also, depending on the number of posts your blog has, the archive pages can run into several paginated pages. As these pages have little to no original content, it is a recommended SEO measure to block them from getting indexed by search engines.

This can be easily done by adding the robots noindex,follow tag within the head section of these pages. A ‘noindex,follow’ robots tag tells the search engine bot not to index the page but still follow the links on the page. This means, the search engines will actively crawl the page and follow the links on the page but will not index the page but the page will not be included in the search engine results pages.

Adding noindex Tags to WordPress Archive Pages
If you are using the Yoast SEO plugin, you can achieve this by going to SEO & Titles & Metas & Taxonomies and Archives and then checking on the noindex, follow checkbox underneath, categories, tags, author and date archive sections. If you are not using the plugin, you can achieve this by adding the following function to your theme’s functions.php page.

Here are the steps to do this:
Step 1: Login to your wordpress dashboard and click on ‘Appearence & Editor’.
Step 2: Now click and open the functions.php page from the right panel.
Step 3: Add the following code towards the end of the page:

/*Add noindex to low value pages*/
function add_noindex_tags(){
	# Get page number for paginated archives.
	$paged = intval( get_query_var( 'paged' ) );
	
	# Add noindex tag to all archive, search and 404 pages.
	if( is_archive() || is_search() || is_404() )
	echo '';
		
	# Add noindex tag to homepage paginated pages.  
	if(( is_home() || is_front_page() ) && $paged >= 2 )
	echo '';
}
add_action('wp_head','add_noindex_tags', 4 );

Step 4: Scroll down and click on ‘Update File’.

This will add a noindex,follow tag to your search pages, 404 pages and all your archive pages, be it a category, tag, author or the date archives page. In addition to that, the function also checks if the homepage/frontpage is paginated, and adds a noindex tag to paginated homepage/frontpage pages.

Adding Noindex Tags Only to Subpages of Archives
An archived sub-page is a paginated page that follows after the main archived page. For instance, for a category named ‘technology’ the following will be the main and sub pages:
Main page:
http://sitename.com/category/technology/

Sub pages:
http://sitename.com/category/technology/page/2/
http://sitename.com/category/technology/page/3/
etc.

If you would like to add the robots noindex tag only to the subpages of the archives, or in other words, allow the first page to be indexed and then add a noindex to all the inner paginated pages, then you can achieve this by adding the following to your functions.php page:

/* Add noindex only to paginated subpages of archives, search and 404 pages */
function add_noindex_tags(){
	$paged = intval( get_query_var( 'paged' ) );
	
        if(is_search() || $paged >= 2  || is_404() )
	echo '';
}
add_action('wp_head','add_noindex_tags', 4 );

Adding Noindex Tags to Specific Pages
You might also want to add the noindex tag to a few non-useful pages like the privacy page, disclaimer page, contact page etc. This can easily be achieved using the is_page() function and adding the page Ids in an array.

For example, if you would like to add a noindex to pages with the ID 14 and 22, you can use the following:

#Add noindex tag to specific pages.  
if( is_page( array( 14, 22 ) ) )
echo '';
See also  Briefly unavailable for scheduled maintenance