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;
}

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.