Disable Author Archives Without Plugin to avoid duplicate content issues and reduce username exposure risks. Here’s how to do it using your child theme.
Step 1: Add the Author Archives Disable Code
Add this code to your child theme’s functions.php:
function qdt_disable_author_archives() {
if (is_author()) {
wp_redirect(home_url());
exit;
}
}
add_action(‘template_redirect’, ‘qdt_disable_author_archives’);
How It Works
This snippet checks if a visitor is trying to access an author archive and redirects them to your homepage instead of showing an author page.
Why Disable Author Archives Without Plugin?
Single-author sites don’t need author pages. Disabling them prevents duplicate pages in search results and stops bots from scraping usernames for brute force attacks.
Common Mistake
If you have multiple authors, disabling author archives might break author pages. Only use this tweak for single-author sites.
Pro Tip
Always add this tweak in your child theme’s functions.php to keep it safe after updates.
Related Snippet
If you liked this, check out my guide on disabling self pingbacks without a plugin in WordPress.