I have disabled the author pages on my WordPress blog using the Yoast SEO plugin, but I saw that when I click the author name, it just redirects me to the homepage. Can I change the URL myblog.com/author/me directly to myblog.com, without a 301 redirect? Thanks!

4 Answers 4


Disabling the author pages is a 'good thing'. A 'bad actor' can enumerate your users, or even get your admin user (which is user id 1) with a simple query on any page. So redirecting author requests is a good idea - and a good security measure. (As is never having a user called 'admin', especially if it has admin privileges.)

For instance, an attacker could use the xmlprc.prg page to post multiple requests to any page. They could look through x number of author id's and get a list of the login names of all the user ids. Then use that list to try to get into the admin pages.

I suspect that the Yoast plugin is redirecting author requests. The code to redirect author requests to the home page will look like this:

function wp_redirect_if_author_query() {

    $is_author_set = get_query_var( 'author', '' );
    if ( $is_author_set != '' && !is_admin()) {
        wp_redirect( home_url(), 301 );     // send them somewhere else
add_action( 'template_redirect', 'wp_redirect_if_author_query' );

Put a variation of this code (with the redirect you want to have) in your Child Theme's functions.php file. Or in a simple plugin. (I have a customized personal plugin where I do all sorts of standard settings, including those related to security.) You might need to give a higher priority to the add_action (the optional third parameter, which defaults to 10) to override what the Yoast plugin is doing.

  • This thing is already done by Yoast. My question is if you can do it without 301 redirects (because, in SEO checkers, I saw it's not a good thing to have too many 301 redirects in the homepage). I mean, when you click on the author name, it should be pointing to the homepage directly.
    – user145970
    Jun 27, 2018 at 16:45
  • Yes you can. Just give your add_action a higher priority than what Yoast is doing. You might have to experiment with priority values. And if you are concerned about a 301 redirect on the home page, then add a check for is_home() in the 'if' statement. Although I don't think 301's on the home page are bad; in fact, they are the best way. See moz.com/learn/seo/redirection . Jun 27, 2018 at 18:03
  • Hmm, so after I do what you said, if I right click on the author name, and copy the link, it should be the link to the homepage? I have tried it with and without is_home(), and with higher and lower priorities, but none of them worked.
    – user145970
    Jun 27, 2018 at 18:29
  • If your link is like example.com/?author=1 , then the function should redirect to the value specified by wp_redirect. If you don't specify the 301, then a 302 is sent. If your link is something else, then use that value in get_query_var. Post your URL, but sanitize it with 'example.com'. Jun 27, 2018 at 18:51
  • I have finally found that my question was answered here. :) The code in the first post works for me. Thank you anyway!
    – user145970
    Jun 27, 2018 at 19:06

If a 301 redirect is not needed, one option is using JS to make the redirect.

;(function( $ ){
$(function() {
     * Redirect on path match
     * @param  The current window url
     * @return New url

    const URLSearchParams = window.URLSearchParams;
    const urlParams = new URLSearchParams(window.location.search);
    const myParam = urlParams;

    let replacer = (function (myParam) {
        let newURL = `/`;
        if (window.location.href.indexOf('author/me') > -1) {
        } else if (!myParam) {
            return undefined;
})( jQuery );

In Yoast just select:

Author Archives - enabled Show in search results - disabled

Better than mucking around with code.


You should find the code in your theme that is outputting the link and then remove it to just show the name of the author as text.

If there are no links to the author pages and they are redirected/noindexed if anyone guesses at them anyway then there isn't a problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.