Learn how to disable WordPress author pages and redirect visitors to the homepage. This step-by-step guide helps you streamline your site’s design and improve user experience without using plugins.
Run your own WordPress site long enough and you’ll notice a page you never asked for: yoursite.com/author/yourname. WordPress builds an archive for every user, even if the whole site is just you. On a single-author blog it’s a duplicate of your homepage feed. Worse, that same archive quietly hands out your login name to anyone who looks. Here’s how to switch it off and send visitors to the homepage instead, using a few lines of code and no plugin.
Why Disable Author Pages?
A couple of reasons hold up, and one of them is about security.
- It leaks your usernames. This is the big one. Visit
yoursite.com/?author=1on most WordPress sites and it redirects to/author/username, exposing the login name of user ID 1. Attackers script this (“user enumeration”) to collect valid usernames, then they only have to guess passwords. Killing the author archive closes that door. - It’s redundant on a single-author site. If every post is written by you, the author archive is just another copy of your post list. One less thin page for search engines to crawl and for visitors to get lost on.
- It keeps navigation consistent. No stray template that a theme styled differently, no author bio you never filled in.
If you run a genuine multi-author publication where readers follow specific writers, keep the pages. This trick is for the rest of us.
Step 1: Access the functions.php File
You’ll add the snippet to your theme’s functions.php. A word of caution first: the built-in Theme Editor edits live files with no undo, and a single typo can white-screen your whole site with no way back in. If you can, edit functions.php over SFTP, or drop the snippet into a child theme or a code-snippets plugin. If you’re going to use the dashboard editor anyway, here’s the path:
- Log in to your WordPress Dashboard with your admin account.
- Open the Theme Editor under
Appearance > Theme File Editor. (Some setups hide this; if it’s missing, that’s your cue to use SFTP instead.) - Select
functions.phpfrom the file list on the right.
Step 2: Insert Custom Code to Disable Author Pages
Add this snippet at the end of the file. It watches for any request that resolves to an author archive and sends the visitor to your homepage before the page renders.
<?php
/**
* Disables author pages and redirects visitors to the homepage.
*/
function disable_author_pages() {
global $wp_query;
// Check if the current page being viewed is an author page.
if ( is_author() ) {
// Redirect visitor to the homepage.
wp_redirect( home_url(), 301 );
exit;
}
}
// Hook the 'disable_author_pages' function into the 'template_redirect' action
// with a priority of 1 to ensure it runs early during the page load process.
add_action( 'template_redirect', 'disable_author_pages', 1 );Code Explanation
The conditional check: The work is done by is_author(), a WordPress conditional tag that returns true when the current request is an author archive. (The global $wp_query; line is left in for context but isn’t actually used here, since is_author() reads the main query for you. You can drop it.)
The redirect: When the check passes, wp_redirect( home_url(), 301 ) sends the browser to your homepage with a 301 (permanent) status, then exit stops WordPress from loading the archive template. If you ever redirect somewhere user-supplied, reach for wp_safe_redirect() instead; for a fixed home_url() target either is fine.
Why template_redirect: This hook fires after WordPress has figured out what page it’s serving but before it picks a template, so it’s the right moment to intercept. Priority 1 runs it early, before other plugins hook in.
Step 3: Save and Apply the Changes
Save the file. In the Theme Editor that’s the Update File button at the bottom; over SFTP it’s just saving and uploading. If the site loads normally afterward, you’re clear.
Step 4: Test the Functionality of Your Website
Now prove it works:
- Open your site in a fresh browser tab or a private window.
- Hit an author URL directly, like
yoursite.com/author/username, and also try the enumeration pathyoursite.com/?author=1. - Confirm the redirect. Both should land you on the homepage instead of an author archive.
Troubleshooting Tips
If you’re still seeing the author page:
- Clear your cache. A caching plugin or CDN may be serving the old archive. Purge it and retest in a private window.
- Check the code placement. Make sure the snippet is in the active theme’s
functions.phpwith no stray syntax errors above or below it. - Rule out conflicts. An SEO plugin or another redirect rule can fight this one. Yoast and a few others already have a “disable author archives” toggle, so if you use one, check there before adding code.
Conclusion
That’s it. Author archives are off and the requests go to your homepage, with no plugin required and one real security hole closed along the way. It’s a small change, but on a single-author site it’s a clean one.
One caveat worth repeating: this hides the archive, it doesn’t rename your users. If username exposure is your main worry, also set each user’s “Display name publicly as” to something other than their login name, so their nicename isn’t the login. And after any edit to functions.php, load a few pages to confirm nothing else broke.


