How to disable author archives in WordPress

The author page or author archive is a default page in WordPress that lists the author's articles on the website. Using author archive pages can cause SEO and security issues. Disabling author archives is a good way to fix these issues and this article will guide you to do that.

Why should not use author archives?

Using author archive pages the wrong way can harm your website SEO and cause security issues
Using author archive pages the wrong way can harm your website SEO and cause security issues

If your website only has one author, it doesn't make sense to have a separate page displaying that author's articles (the author archive page). Because all the articles on the website belong to that author already. So the author page will become redundant. If you use Slim SEO, in this case, the plugin will automatically redirect the author page to the homepage.

If your website has multiple authors, but you only present the author pages as usual archive pages. As such, it is possible that the search engines will consider them as duplicated content, since those articles are already listed in the category pages. In this case, you should also disable author pages to increase your website's SEO score.

A third reason you should remove author pages is for security purposes. The link to the author page has the format domain.com/author/username, which contains the author username. Once the page is indexed by Google, people can easily find out what the author username is. And with brute-force techniques, hackers can figure out the user's password and take control over the account.

For the above reasons, if you really don't need it, turn off the author pages to improve SEO and security of the website.

How to turn off author pages

The methods below require you to know how to add a code snippet to the functions.php file in your theme. If you don't know how, use the Code Snippets plugin to make it easier to insert code.

Don't index author pages with robots tag

If you just want Google to not index the author pages, but keep them functioning, use the code snippet below:

add_filter( 'slim_seo_robots_index', function( $value ) {
    return is_author() ? false : $value;
} );

This code will add a noindex robots tag to the website header, which instructs Google and other search engines to not index the pages.

Note that you need to install the Slim SEO plugin for the code to work.

Redirect author pages to the homepage

If you want to disable author pages completely, and redirect the author pages to the home page, use the following code:

add_action( 'template_redirect', function() {
    if ( is_author() ) {
        wp_redirect( home_url(), 301);
        die;
    }
} );

When to use author pages

Although it is not recommended to use author pages, there are cases where you can still use them. That's when you want to display author pages as portfolio pages of the authors, which can include their avatar, introduction and articles.

Of course, to do that, you'll need to customize your theme quite a bit, or use plugins like page builders or MB Views if you don't want to touch code.

In this case, the author pages become pages with useful content, and therefore will not affect SEO. However, security issues still remain.

Completely turning off author archive pages by redirecting or not indexing them are simple ways to increase SEO and reduce security issues on your website. So, apply now to make your website better and better.

2 comments

  1. Would this ever become a simple checkbox within Slim SEO? It would be great to see even the simplest settings around site maps where a person could simply check whether to include a post type or authors in the site map.

Leave a Reply

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