How to Disable the Author Page in WordPress

The author page is an integral part of WordPress and make it easier for visitors to find other articles the author may have written. If you have a multi-author WordPress website the author page is essential for your author to showcase their work. If you have a single-author WordPress website there isn’t much need for an author page as all articles will be written by one person and therefore that feature become redundant.

Also, from an SEO stand point, it could create duplicate content on your website which could impact search engine rankings. Where multiple pieces of, as Google calls it, “appreciably similar” content, it can be difficult to decide which is more relevant to a given search query. From a security point of view, the author page exposes the authors WordPress username in its URL. Therefore, it could be more beneficial to disable the author page totally.

In this guide, we will show you how to disable the author page in WordPress and redirect to either your website home page using either 301 or 302 redirect or the 404 error page using the functions.php file. This option provides the most configurable control for you to disable your author pages.

Important

In this tutorial, we'll be directly editing WordPress theme files and we recommend that you create a child theme of your existing parent theme. By using a child theme you will be able to apply modifications without altering the parent theme files and ensuring any changes you make are kept following any parent theme updates.

Note

If you don't feel comfortable with editing the functions.php file directly, we would recommend you use the Code Snippets plugin. This plugin will enable you to easily add, manage and delete WordPress code snippets from your dashboard. To find out more about adding custom code snippets using a plugin see our tutorial How to Add Custom Code Snippets to WordPress with the Code Snippets Plugin for more information.

If you don’t feel comfortable of editing the functions.php file or using the Code Snippets plugin to disable the author page, you can use the Disable Author Archives plugin to achieve a the same result without editing code. The plugin doesn’t require any configuration once it’s been activated. However, the plugin will only redirect to the 404 error page.

Redirect to Home Page

To disable the author page from WordPress and redirect using either a 301 or 302 redirection, simply copy and paste the following code into your functions.php file:

// Redirect Author Page to Home
function vpsb_redirect_author_page() {
	global $wp_query;

	if ( is_author() ) {
		// Redirect to home, set status to 301 permanent or 302 temporary 
		wp_redirect(get_option('home'), 301); 
		exit; 
	}
}
add_action('template_redirect', 'vpsb_redirect_author_page');

Note

You can set the redirect to the home page to either use 301 (Moved Permanently) or 302 (Moved Temporarily). From an SEO point of view it is best to use 301 (Moved Permanently) and is the recommended way to implement redirects on a website. However if you wanted to use 302 (Moved Temporarily), you can change the code from wp_redirect(get_option('home'), 301); to wp_redirect(get_option('home'), 302);.

Redirect to 404 Error Page

To disable the author page from WordPress and redirect to the 404 error page, simply copy and paste the following code into your functions.php file:

// Redirect Author Page to 404 
function vpsb_redirect_author_page() {
	global $wp_query;

	if ( is_author() ) {
		// Redirect to 404 error page 
		$wp_query->set_404();
		status_header(404);
	}
}
add_action( 'template_redirect', 'vpsb_redirect_author_page' );

That’s it. You have successfully disable the author page in WordPress and set up a redirect to either the homepage or 404 error page.

How useful was this guide?

Click on a star to rate it!

Average rating / 5. Vote count:

Be the first to rate this guide.

We are sorry that this guide was not useful for you!

Help us to improve this guide!

Tell us how we can improve this guide?

By VPSBasics

This guide was written by the VPS Basics editorial team, led by Gilberto Van Roosen. They are a unique blend of people, dedicated to providing highly detailed, comprehensive and importantly easy to follow tutorials, written in plain English. They specialise in tutorials for managing Linux servers and its software.

2 Comments for How to Disable the Author Page in WordPress

Dear VPSBasics-Team,

I wanted to kindly point you to a syntax error in your redirect code. In line 11 there is a [ ` ] instead of a [ ‘ ] in front of vpsd.

Fixing that, the code now works for me. Thank you!

Join the Conversation

Note: Your email address will not be published when posting a comment.

Note: All comments are held for moderation and are reviewed by our editorial team prior to approval.

VPSBasics uses Akismet anti-spam filters to reduce spam across our website. Our website is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Learn how your data is processed.