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!

18 thoughts on “Quick tip; disabling WordPress author pages

  1. Michael Nordmeyer

    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
    1. frank Post author

      I often prefer my own simple solutions. Knowing what’s under the hood and all ;-)

      And somehow I feel having author pages should be decided within the theme (or theme settings), not a plugin.

      Reply
      1. Yossi Aharon

        The option is still exist on Yoast. Go to “Titles & Metas”, press on “Archives”, then under “Duplicate content prevention” select the option “Disable the author archives”.

  2. Steve Pringle

    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. Jameson Williams

    Frank — good tip. I actually want to just generate a 404 page (the same one that’s already in my theme) so I used your approach of introducing author.php, but mine reads:

    Reply
  4. ahmed

    hiding the author URL that well get you 404 error ? if it s indexed is that gonna hurt you rank ?
    if yes how to show them
    thanks

    Reply
  5. Mohammed

    Nice,
    Thank you, What about these :-
    Category based
    Tag based
    Date based (daily, monthly and yearly)

    Reply
  6. JP

    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
    1. frank Post author

      You could copy archive.php but add the 2 header-lines from the original post if the user has “activate_plugins” capabilities?

      Reply
      1. JP

        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.

Leave a Reply

Your email address will not be published. Required fields are marked *