How to Hide or Disable Archives in WordPress?

How to Hide or Disable Archives in WordPress?

As we know that wordpress is an amazing CMS (content management system) and most of the people use it because it’s easy to manage a wordpress website. We all know about Google and SEO, Google has its own set of rules to rank a website and duplicate content is the top most rule of Google which can lower the rank of your website.

What are Archives in wordpress ?

Wordpress automatically generates archive URLs for websites and makes redundant content on website, that’s why we always like to hide archives in wordpress. In some cases archives are also useful but sometimes it can also hurt your SEO rank by generating redundant content. Wordpress generated following archives by default: tag archives, category archives, Date archives, Author archives, search archives, post format archives.

Why we need to disable or hide Archives in wordpress ?

Now the main question is why we need to hide Archives, Archives are the automatically generated content by wordpress and Google always consider this content as a duplicate content. As a blogger we all know how duplicate content badly affect our website’s SEO, so its better option to disable archives in wordpress.

Don’t you worry there is a quick solution of this problem thorough which you can hide or disable archives. Let’s see how we can disable the archives in wordpress.

Disable archives in wordpress via plugin :

You can hide the archives through plugins, there are several plugin are available to disable it but we recommend you to use “SEO Ultimate” plugin. SEO plugin has various functions in just one plugin. Leys see how to disable Archives through this plugin.

1. First Install the SEO ultimate plugin.

2. After that click on “Modules” under the SEO option.

seo2.png


3. You can find here “Meta Robots Tags Editor” option after scrolling, click on it. This option will allow you to configure the indexing of your blog.

seo.png


4. If you need to disable the indexing of few posts of your domain then that’s possible under “Posts” tab. Here you can disable the indexing of desired of posts. But if you want to disable the indexing according to categories then choose “Defaults” tab.

5. Under defaults tab you can see lists of pages for example author archives, the category archives, and the date-based archives. Sometimes these options are useful but if not you can disable it.

defaults.png



Disable archives in wordpress through code :

Sometimes disable the indexing is not enough because it can be directly accessed through URLs. So if you want to redirect these archives to your home page then you can add the following code in our “functions.php”.

Code:
function redirect_to_home( $query ){
   if(is_date() ) {
  wp_redirect( home_url() );
  exit;
  }
}
add_action( 'parse_query', 'redirect_to_home' );
As you can see, in this code we have redirect the date archive to home page by adding this function “is_date()“. Just like that if you want to disable every single archive in your wordpress site then you can use “is_archive()” function in your code. Through this function you can disable every single archive for your site.
Author
bhawanisingh
Views
21,263
First release
Last update
Rating
0.00 star(s) 0 ratings
Top