Did you know that WordPress automatically generates multiple archive URLs for your website? While it may be useful in some cases, it may also hurt your SEO by generating duplicated content and unnecessary pages. Luckily, there is a quick and easy solution.
Why remove (or disable) archives in WordPress?
By default, WordPress will generate the following archives:
- Category archives
- Tag archives
- Author Archives
- Date archives
- Post format archives (if your WordPress theme supports it)
- Search archives (search results page)
Category archives
If you don’t have any categories on your website, all posts will automatically go to “Uncategorized” category and you will still have something like http://yourwebsite.com/category/uncategorized URL which is actually displaying the same content as your home or blog page. It just doesn’t make sense!
Of course, categories are sometimes crucial part of your WordPress websites and can be very useful. You can read more in this article about good SEO practice of using categories and tags on your WordPress website.
Tag archives
Sometimes people use a lot of “generic” tags which doesn’t make sense from a point of SEO, but can be rather useful to connect posts in a good way and display related content to a particular post. This means that you can keep using tags in the background and only avoid to display tag links and tag archive pages.
Author archives
If you have a lot of writers on your website you will probably want to use author archives. But, if you have only one author on the website then it just doesn’t make sense. Feel free to remove it and avoid duplicated content.
Date and other archives
Date archives and post formats archives are mostly unnecessary especially if you don’t publish your posts frequently. For search results archive, you will of course want to keep it for obvious reasons.
How to disable WordPress archives?
In the following snippet we are going to remove (disable) category, tag, date, and author archives but you may want to modify conditional statements inside the code to suit your exact needs. Just place this piece of code somewhere in your theme functions.php file:
1 2 3 4 5 6 7 8 9 10 11 | /* Register template redirect action callback */ add_action('template_redirect', 'meks_remove_wp_archives'); /* Remove archives */ function meks_remove_wp_archives(){ //If we are on category or tag or date or author archive if( is_category() || is_tag() || is_date() || is_author() ) { global $wp_query; $wp_query->set_404(); //set to 404 not found page } } |
Bonus tip
In some cases, you may rather want to “noindex” your archives instead of removing it entirely. This means that your archives will be accessible but you will say to Google not to index those pages. Luckily, there is probably the best SEO WordPress plugin which will help you achieve this very easily.