0

I'm trying to disable author's link when author's name is displayed. I don't want anything that links to the author archive. Just text without <a href>.

What template or file should I edit? I tried the theme template but couldn't find anything, maybe it's something related to the wp files

5
  • This is entirely dependent on your theme. You should check single.php if it has the author code.
    – Sid
    Commented Dec 18, 2017 at 12:28
  • Thank you for your reply. Do you know what kind of code should I look and replace? Commented Dec 18, 2017 at 13:09
  • @PaoloMontalto it should be clear via a reading of code, look for the HTML that matches the surrounding HTML when you view the page, or better yet, do a find in folder using your editor on the word author. Any half decent text editor should be capable of this. Also keep in mind any answer you get will require at least beginner level PHP knowledge to understand, but you can acquire this in several hours via many online tutorials
    – Tom J Nowell
    Commented Dec 18, 2017 at 13:12
  • Yep, I did look at the code and found author. To test the code I removed the entire block of code that contains author, but no changes have been applied. That's why I thought it was not the place to look for Commented Dec 18, 2017 at 13:20
  • it will be helpful if you could provide us the website url
    – Sid
    Commented Dec 18, 2017 at 13:40

2 Answers 2

5

You have actually two problems to solve here:

  • The first one is to remove the HTML link, which you are trying to achieve right now. As you read in the comments, it depends on your theme. You could find it looking for the exact HTML displayed around the author name (CSS classes etc), and then seeking for it in the files of the theme (including the WordPress folder perhaps) with an editor.

  • The second issue is less evident but probably more important: you have to actual remove that page. If you just remove the links from your template, the pages will be always visible reaching the URL http://yousite.com/author/username/.

    Getting inspiration by the way SEO Yoast does, you can disable the author archive page with a code like this:

    function disable_author_page() {
        global $wp_query;
    
        // If an author page is requested, redirects to the home page
        if ( $wp_query->is_author ) {
            wp_safe_redirect( get_bloginfo( 'url' ), 301 );
            exit;
        }
    
    }
    add_action( 'wp', 'disable_author_page' );
    
1
  • it's working for me. upvote from my side Commented May 30, 2022 at 13:52
0

Use developer tools on your browser to check for the author handler it could be .author or .author-name or .author-title and so forth.

Then in Appearance >>> Customizations >>> Add Custom CSS do the following

  1. Add the author handler

  2. Add the CSS parameter: pointer-events: none (This one will disable author link on posts/pages)

    .author-title { pointer-events: none; }

3
  • That would work on some of the standard themes, yes, but the author-title class isn't from WordPress so this might not work everywhere.
    – Rup
    Commented Jan 27, 2021 at 13:29
  • 1
    Like I have said you have to use developer tools on your browser to get the author hook. And I have given a few examples of how it can vary from one theme to another. Are there any WordPress themes that lack the author hook?
    – Deewinc
    Commented Jan 27, 2021 at 19:17
  • Thank you for your answer @Deewinc For the ones wondering how to remove author link on Wordpress Divi Theme, the right author handler is .author.vcard Nevertheless, while it makes the link unclickable, in the source code there is still the href link. From a SEO perspective, I would like the Google bots to not find this link and not crawl it. Any idea how? Cheers!
    – Quentin H.
    Commented Aug 31, 2021 at 14:27

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.