Skip to main content
Login Join
Snippet · PHP

Disable WordPress Author Archives

Shared by Amit Dholiya · June 17, 2026

10 views
Back to Snippets

Author archive pages can reveal usernames and are often unnecessary on single-author websites. Disabling them can improve security and reduce duplicate content.

Steps

  1. Open your WordPress theme functions.php file.
  2. Add the code below at the end of the file.
  3. Save the file.
  4. 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');
Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments