Redirect Author Archives to Homepage (or Page) in WordPress
If you want to redirect author archive WordPress pages to your homepage or a custom page, this tutorial shows you how to do it quickly and effectively. Author archives often reveal usernames or create duplicate content issues, so redirecting them can improve security and SEO.
Quick Fix
- Add a simple PHP snippet to your theme’s
functions.php
file or a site-specific plugin. - Choose whether to redirect to the homepage or a custom URL.
- Test the author archive URLs to confirm the redirect works.
Why This Happens
By default, WordPress generates author archive pages at URLs like yoursite.com/author/username
. These pages list all posts by that author. However, if you only have one author or want to hide author information for security or SEO reasons, redirecting these archives is a common approach.
Redirecting author archives prevents:
- Exposure of usernames that can be exploited in brute force attacks.
- Duplicate content issues that may harm SEO rankings.
- Unnecessary archive pages that don’t add value to your site.
Requirements
- Access to your WordPress theme files or ability to add custom code via a plugin.
- Basic knowledge of editing PHP files safely.
- Optional: FTP or hosting control panel access for file editing.
Step-by-step Guide to Redirect Author Archives
- Backup your site. Always create a backup before editing theme files.
- Access your theme’s
functions.php
file. You can do this via WordPress Admin Dashboard under Appearance > Theme Editor, or via FTP/cPanel file manager. - Add the redirect code snippet. Copy and paste the following code at the end of the
functions.php
file:
function redirect_author_archives() {
if (is_author()) {
wp_redirect(home_url(), 301);
exit;
}
}
add_action('template_redirect', 'redirect_author_archives');
This code checks if the current page is an author archive and redirects visitors to the homepage with a permanent (301) redirect.
- Redirect to a custom page (optional). If you want to redirect to a specific page instead of the homepage, replace
home_url()
with the URL of your choice, for example:
wp_redirect(home_url('/custom-page/'), 301);
- Save the changes. Update the file and clear any caching plugins or server caches.
- Test the redirect. Visit any author archive URL like
yoursite.com/author/username
to confirm it redirects correctly.
Common Pitfalls
- Editing the wrong
functions.php
file: Make sure you edit the active theme’s file or use a child theme to avoid losing changes on updates. - Cache interference: Clear browser, plugin, and server caches after adding the code to see the redirect immediately.
- Plugin conflicts: Some SEO or redirection plugins may override this behavior. Disable them temporarily to test.
- Incorrect URL in redirect: Ensure the URL passed to
wp_redirect()
is correct and includes trailing slashes if needed.
Works on
Server/Environment | Compatibility |
---|---|
Apache | Fully compatible |
Nginx | Fully compatible |
LiteSpeed | Fully compatible |
cPanel / Plesk | Fully compatible |
Any WordPress environment | Compatible as long as PHP code can be added |
FAQ
-
Can I redirect author archives without editing
functions.php
?Yes, you can use a plugin like “Redirection” or an SEO plugin with redirect features, but adding code is lightweight and efficient.
-
Will this affect SEO negatively?
No, a 301 redirect tells search engines the author archive pages are permanently moved, preventing duplicate content issues.
-
How do I redirect only specific authors?
Modify the code to check for specific author IDs or usernames before redirecting. Example:
function redirect_specific_author_archives() { if (is_author('username')) { wp_redirect(home_url(), 301); exit; } } add_action('template_redirect', 'redirect_specific_author_archives');
-
What if I want to disable author archives instead of redirecting?
You can disable author archives by returning a 404 status or using SEO plugins to noindex those pages.
-
Is this method safe for multisite WordPress?
Yes, but ensure you add the code to each site’s theme or a network-activated plugin if you want it site-wide.