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

  • This is entirely dependent on your theme. You should check single.php if it has the author code. – Sid Dec 18 '17 at 12:28
  • Thank you for your reply. Do you know what kind of code should I look and replace? – Paolo Montalto Dec 18 '17 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 Dec 18 '17 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 – Paolo Montalto Dec 18 '17 at 13:20
  • it will be helpful if you could provide us the website url – Sid Dec 18 '17 at 13:40
3

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' );
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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