How to remove the author pages?

The above answer is good, but if redirecting to home page, it should specify a 301 status and exit after.

add_action('template_redirect', 'my_custom_disable_author_page');

function my_custom_disable_author_page() {
    global $wp_query;

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

wp_redirect() documentation https://developer.wordpress.org/reference/functions/wp_redirect/

Leave a Comment