Author archive pages can reveal usernames and are often unnecessary on single-author websites. Disabling them can improve security and reduce duplicate content.
Steps
- Open your WordPress theme
functions.phpfile. - Add the code below at the end of the file.
- Save the file.
- Visit an author URL such as
/author/admin/to test.
Done — author archive pages will redirect to the homepage.
⚠️ Use this only if your site does not need public author profile pages.
function disable_author_archives() {
if (is_author()) {
wp_redirect(home_url(), 301);
exit;
}
}
add_action('template_redirect', 'disable_author_archives');