Remove category archives from WordPress (or tag date and author archives)

Remove category archives from WordPress (or tag date and author archives)

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 keep) 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.

Here comes the solution

In the following snippet we are removing 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:

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.

Bojan Petrovic

Co-founder and WordPress developer at Meks. He has been involved in the business since 2009. creating themes, plugins and services on top of WordPress, continuously aiming to choose best approaches and work smarter, not harder.

16 comments

Leave a comment
  • As always I can find here useful tip. For me you are the WordPress masters! 🙂 I think its about 10th time when I come here and find solution I needed. Good job.

  • It’s my first time on your site but I already know that I will visit you often 🙂 Good job.

    One question, will noindex attribute give me 100% certainty that google won’t register it as a duplicate content?

  • Thanks for this tip, Developer of Yoast WordPress SEO plugin has explained very well that it is always good idea to Disable unnecessary archives for better WordPress SEO.

    WordPress users can use WordPress SEO plugin to disable the author archives or date based archive.

  • Hello
    Because I really do not want those pages, that’s hat I’have done:
    add_action(‘template_redirect’, ‘meks_remove_wp_archives’);

    function meks_remove_wp_archives(){
    if( is_category() || is_tag() || is_date() || is_author() ) {
    wp_redirect( home_url(), 301 ); exit;
    }
    }

  • A word of warning that this doesn’t send a 404 header, so if you have links to these pages they will still be indexed by search engines. Update your function to this:

    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;
    header(“HTTP/1.0 404 Not Found”);
    $wp_query->set_404(); //set to 404 not found page
    }
    }

  • If only I saw this before I launched a WordPress site 🙂
    Well it took me some time to de-index those archives as well as categories, tags and other rubbish generated by some plugin. But indeed it’s worth it, no more wasting crawl budger

  • I desperately needed this post. As a newbie blogger, I thought adding recent comments and post archives on the widget bar was cool. I recently discovered that it created duplicate content per google. For example, currently, my blog shows 14 Google indexed pages when I’ve only written about 5 posts. I hope I can remove the tag date and author archive successfully. I use Yoast plugin so I will try that route. Thanks for the post!

  • The code does NOT remove the functionality, it simply returns a 404 error if those archive / categories are requested. However Google still indexes them. The comment from “Cameron” helps, but alas, this still does not turn off that functionality.
    😉

Leave a Reply

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