How to Remove Category, Tag, Date, and Author Archive Pages in WordPress

WordPress will automatically generate many archive pages for us, and sometimes these archive pages are useful. Sometimes, these archive pages generate a lot of duplicate content and unnecessary pages, which may have some impact on SEO performance. If archived pages serve no specific purpose, we can remove these archived pages to helpImprove SEO performance

Default archive page in WordPress

By default, WordPress generates the following archive pages for us:

  • Category Archives
  • tag archive
  • Author Archives
  • Date archive
  • Article format archive (if the theme supports article format)
  • Search results archive (search results page)

If we add a custom post type and a custom classification method, WordPress will also generate for us:

  • Article Type Archives
  • Taxonomy Project Archives

Category Archives

If our website did not use categories to organize content, all articles would automatically be added to“Uncategorized”Category directory, the archive page of this default category directory ishttp://yourwebsite.com/category/uncategorized, and the content of this category archive page will be exactly the same as the homepage or blog page, which results in the appearance of duplicate content.

Of course, there are some sites where WordPress categories are very useful. If used properly, it is very helpful to enrich our site.

tag archive

Sometimes, people use a large number of “generic” tags, which are meaningless from an SEO perspective, but tags can be used to associate articles in a very flexible way and display related content into a certain article. This means you can continue to use tags in the backend while avoiding tag links and tag archive pages on the front end.

Author Archives

When our website has multiple authors and we need to generate an article archive for each author, author archives are a very useful feature. However, if the website has only one author, like the case of only one category, displaying author archives will generate duplicate content for our site and affect the SEO effect.

Date and article format archive

If our website is not updated frequently, date archiving and article format archiving are of little significance. Users can just search for any articles they need to see.

How to remove unnecessary archive pages

The following code removes categories, tags, dates and author archives for us, and can be pasted directly into the theme’s functions.php. If you don’t want to remove certain types of archives, just delete the conditions in the judgment statement.

/* 移除不必要的存档页面 */
add_action('template_redirect', 'meks_remove_wp_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
  }
}

Of course, in addition to completely removing these archives, we can also design the “noindex” tag to let WordPress ignore these archives. Compared to the method of setting noindex, I prefer the method introduced in this article to reduce some unnecessary pages and introduce some confusion to users. Less is more.

Related Posts

Leave a Reply

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