How To Disable Author Archive Pages Without A Plugin
WordPress has a lot of cool archives built into the default system. For example, the following each have their own archive:
- Each Taxonomy
- Search
- Author Archives
For single author websites, author archives do not do much good; as they will look just like the homepage. I will note, author archives can be disabled in Yoast SEO, and there may be a more efficient way of doing this, but this is what has worked for me.
/* Disable Author Pages (Archives) */
function sertmedia_disable_author_archives() { if (is_author()) { global $wp_query; $wp_query->set_404(); status_header(404); } else { redirect_canonical(); } } remove_filter('template_redirect', 'redirect_canonical'); add_action('template_redirect', 'sertmedia_disable_author_archives');
This isn't the largest snippet and it's quite efficient. Essentially, if you are on an author page then it will return a 404. This is a quick fix to remove pages without having to implement meaningless redirects. This can be added to the following places:
- functions.php file of a child theme
You can change this code to do a 301 redirect to your homepage or any number of things, but this is a quick and simple way to disable author archive pages without a plugin.
Do you have any questions about this implementation? If you need assistance or have a question feel free to ask me in the comments below and I will make sure to get back to you!
Scott Hartley
Founder & CEO, Sert Media
Founder and CEO of Sert Media, a Nashville-based digital marketing agency. Scott has spent over 15 years helping businesses grow through SEO, web performance optimization, and strategic digital marketing. His deep expertise in WordPress development, site speed, and technical SEO has guided hundreds of brands toward measurable results. When he's not auditing Core Web Vitals or refining campaign strategies, he's writing about the tools, techniques, and trends shaping the modern web.
Related Articles
How to Add Security Headers to WordPress Using Cloudflare Transform Rules
If you've ever run your WordPress site through securityheaders.com and gotten a D or F…
Use This Cloudflare Rule To Reduce Plugin Hack Attempts
Cloudflare Firewall Rules give you a lot of flexibility in further protecting your website. Here…
Set Up Cloudflare's Automatic Platform Optimization Feature
Automatic Platform Optimization (APO) is a new feature from Cloudflare that allows you to cache…