/* Disable Author Archives WordPress, Redirects to 404 */
function wpflt_remove_wp_author_archives(){
if( is_author() ) {
global $wp_query;
$wp_query->set_404();
}
}
add_action('template_redirect', 'wpflt_remove_wp_author_archives');
WordPress Author Archive URL: https://example.com/author/username/
If you are the only author, you probably may need to disable author archives in WordPress. Above code to functions.php redirects Author Archive URL to 404 Page.
Below code redirects WordPress Author Archive URL to Homepage.
/* Disable Author Archives WordPress, Redirects to Homepage */
function wpflt_remove_wp_author_archives(){
if( is_author() ) {
$target = get_option('siteurl');
$status = '301';
wp_redirect($target, 301);
die();
}
}
add_action('template_redirect', 'wpflt_remove_wp_author_archives');