You can remove author name URL from your generatepress theme, by using two methods.
One method is, to insert code in functions.php of GeneratePress child theme and other is by using code snippets plugin.
Table of Contents
Remove URL from Author Name Using Code Snippets
Code snippets plugin is one of the best way to add PHP coding to your there’s functions.php file.
Because, if you insert php code into your theme’s straightaway to your theme’s functions.php in theme editor, you can break your site for ever.
So to overcome such a complex situation, you must use Code Snippets plugin which helps to add any PHP code to your WordPress theme without any code break.
Steps To Remove Author Link Using Code Snippets
Firstly, Install and activate code snippets plugin by doing the following steps :
- Go to Plugins >> Add New Plugin >> Code Snippet.
- Install and activate the plugin.
- Next, Go to Snippets >> Add New >> Give the title.
- Copy the below code and Paste into the blank space.
- Last Save Changes and Activate.
Copy This Code
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() )
)
);
}
Remove URL From Author Box Using GeneratePress Child Theme
The above method is best to remove anchor link from author name.
But alternately, you can use GeneratePress child theme to Insert the above code into your theme’s functions.php.
The best thing about GeneratePress theme is that it’s developer Tom Usborne has provided GeneratePress child theme to his Premium users.
You can download the child theme for generatepress from the below link.
Download GeneratePress Child Theme
This downloaded child theme file will a zip file.You need to upload to your theme.
To install the child theme, save it as a .zip file to your PC.
Then go to Appearance >> Themes >> Add New >> Upload and upload the .zip file.
For better understanding about GeneratePress child theme, go to Child Theme Documentation.
Final Thought
So finally, you see that how easy it is to remove URL from author name in GeneratePress theme.
You can remove author name hyperlink using popular plugin Code Snippets, which is the best way to do.
Besides it, you can use child theme method.
Related: How to Reset WordPress Site?
But you must prefer the easy method that is by using code snippets plugin.