How To Change The Link To The Author’s Archive Page

This tutorial shows you how to change the authors link to any URL.

By default, the authors name will be linked to the authors archive page however you might want to change that to something else.

Using the author_link filter in a custom function, you can modify the default output to any URL of your choosing.

add_filter( 'author_link', 'modify_author_link', 10, 1 ); 	 	 
function modify_author_link( $link ) {	 	 
    $link = 'http://example.com/';
return $link;	 	  	 	 
}

Simply add the code at the bend of your child themes functions.php file and change the URL in the code to suit your own requirements.

The code works in any theme.

StudioPress themes display this link in the entry meta in the entry header. Some themes may display the link in the author box or another location.

You’ll find this filter in the WordPress wp-includes/author-template.php file.

/**
* Filter the URL to the author's page.
*
* @since 2.1.0
*
* @param string $link            The URL to the author's page.
* @param int    $author_id       The author's id.
* @param string $author_nicename The author's nice name.
*/
	$link = apply_filters( 'author_link', $link, $author_id, $author_nicename );

	return $link;
}

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.