How to Remove URL from Author Name in GeneratePress Theme?

In this tutorial, we are going to learn to remove URL from Author Name in GeneratePress Theme. By default, there is a link in the Author Name in every WordPress theme. When you hover over the author’s name you can see the link.

The link reveals the WordPress username. so the best solution for this is to hide or remove the URL/link from the Author Name.

Remove Link from Author's Name

As I am using GeneratePress Premium Theme. There are many ways to insert a code in GeneratePress but here we are using a plugin Method.

Here, we are going to use the Code Snippets plugin. It is one of the best plugins to insert PHP Snippets in functions.php.

Every time you use the theme’s functions.php, you may mess up with the original theme codes.

so for that, you don’t have to create a child theme as the Code Snippets plugin provides the extended functionality to insert PHP code in WordPress sites.

Alternative Method: You can create a GeneratePress Child Theme and you can use functions.php to insert the following code.

The best thing about a GeneratePress child theme is that you don’t have to create it yourself. Tom Usborne, the founder and lead developer of GeneratePress has created a child theme for you.

Also Read: Display Related Posts in GeneratePress Theme

Remove URL from Author Name in GeneratePress Theme

Follow the simple step to Remove the link from the Author Name in GeneratePress Theme.

  1. Go to Plugins > Add New > Install Code Snippets
  2. Activate the Code Snippets Plugin.
  3. Go to Code Snippets > Add New
  4. Add the Following Code.
  5. Activate it.
add_filter( 'generate_post_author_output','tu_no_author_link' );
function tu_no_author_link() {
	printf( ' <span class="byline">%1$s</span>',
		sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <span class="fn n author-name" itemprop="name">%4$s</span></span>',
			__( 'by','generatepress'),
			esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
			esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ),
			esc_html( get_the_author() )
		)
	);
}
Removing Link from Author Name in GeneratePress using Code Snippets plugin

Bottom lines

I hope this Remove URL from Author’s Name code will help you to get the desired result.

If you have any feedback/comments, please feel free to comment or contact us.

Share:

I am obsessed with WordPress and write articles about WordPress Speed Optimization, SEO, and Blogging. I mostly publish tutorials on GeneratePress, Astra, Kadence, and GenerateBlocks.

12 thoughts on “How to Remove URL from Author Name in GeneratePress Theme?”

    • Hi Vishesh, I have tested the code in a free theme too. The code is perfectly working.
      1. Go to Plugins > Add New > Install Code Snippets
      2. Activate the Code Snippets Plugin.
      3. Go to Code Snippets > Add New
      4. Add the above Code.
      5. And don’t forget to Activate it.

      Also, can you mention the steps you have done?

      Reply
  1. brother can you make a tutorial on ‘how to create shadow box around all images in blog posts in generatepress like your website?

    Reply
    • Hi Roshan,
      I have implemented the same code on my website and it is working fine without any problem.
      1. Please Check at Settings > Discussion, if there is Avatar Display Off.
      Thanks

      Reply
  2. Two questions:

    1. How do I do this without a plugin? I have the premium version.

    2. I saw Nutan’s comment and also wanted to know the code for the widgets with shadowbox. You said to use Inspect Element and copy the code. I found the following code, put it into Additional CSS, but cannot make it work for me. I must be leaving something out or doing something wrong.

    element.style {
    }
    #wpsp_widget-3, #wpsp_widget-4 {box-sizing: border-box;
    box-shadow: rgba(23,43,99,.4) 0 7px 28px!important;
    margin-bottom: 25px;
    border-radius: 10px;
    padding-top: 15px;
    }

    Reply
    • Hi Michelle,
      1. I have also mentioned the code in the post so you can use the code directly using the Code Snippets plugin.
      2. For Box Shadow, only use box-shadow code to your desire ID or Class.

      Thanks

      Reply
  3. Hey Suraj,

    Thank you very much, The code works for me.

    I just have a question

    How can i show the all postd written by an author once the user clicks on the author name (The author name below the title).

    By default it redirect to the homepage. If the 404 redirect to homepage plugin is installed, however without the plugin it shows 404 erorr

    Reply

Leave a Comment