WordPress- How to redirect (disable) author page

The following WordPress PHP function shows how to redirect the author page to the home page.

It will redirect using the HTTP 301 code, which tells the browser that the page has moved permanently.

If you’re not sure where to place this code I highly recommend you read How to create a WordPress plugin for your custom functions.

// redirect author page to home page 301

add_action('template_redirect', 'itsg_redirect_author_page');

function itsg_redirect_author_page() {
global $wp_query;

if ( is_author() ) {
     // Redirect to homepage, set status to 301 permenant redirect.
     wp_redirect( get_option('home'), 301) ;
     exit;
     }
}