Quick tip; disabling WordPress author pages

I helped build a WordPress-site for a not-for-profit and they asked me to disable the author pages. Although I’m sure there are multiple plugin-based solutions, I ended up simply adding an author.php to my (child) theme with this in it;

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: /");
?>

As author.php is used for all author pages (if available, else archive.php is used), every attempt to reach an author page will result in a permanent redirect being sent, effectively disabling the author archive. Keeping it simple stupid!

28 thoughts on “Quick tip; disabling WordPress author pages”

  1. Or you can use WordPress SEO by Yoast, which has an option to disable and redirect author pages.
    But a simple solution is nice, if you don’t want to use the reasonable SEO options to improve your blog.

    Reply
  2. This will work out great for me as I do not want to use Yoast’s plugin. For one, it is in conflict with 3 plugins I already use (because of similar features) and two, I can not control the canonical on my site due to it. The site has an SSL certificate and loads with the https protocol but I want SE’s to index the non-https version of the site since I may may drop the SSL feature in the future and Yoast’s plugin keeps setting the canonical to the https so I had to drop it altogether.

    Reply
  3. Researching different ways to do this. What would you think might be the best way to only block authors with certain user roles. I am looking to block the author page for all admins, but leave it open for authors of the blog, which might be userful, or when it is used as the profile for agents on a real estate page.
    Thanks

    Reply
      • Thanks, I was thinking about something like that. A lot of the sites I do don’t use “authors” at all and I never thought of just blocking this off on default for all mys sites. I noticed that there are author pages even generated for admins and this could expose email addresses, which is not a good thing. I almost think that WordPress should have a toggle on and toggle off built into the core as WordPress is being used for some many different types of sites these days.

        Reply
  4. This may be slightly off topic, but this article came up high in my search results. If you have a domain.com/author/PageYouDontWant will doing this delete it and also prevent it from being automatically recreated?

    Reply
  5. Didn’t even realize that either, I’m extremely new to WP. Have you written an article on all your little tweaks like that to help secure a WordPress install?

    Reply
      • That’d be a pretty good article if you ever do get a change to write that up, bet it would be near the top of Google search results just like this one was for me.

        Reply
  6. Oh wow thank you Frankie G!
    I have Yoast installed on my WP site but I really prefer this under-the-hood tweak. Tested it and it worked just as it said it would.
    Thank you!

    Reply

Leave a Reply to frank Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.