• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2784

Original Genesis Tutorials & 6000+ Guaranteed Code

Snippets

  • Consultation
  • Full Access
  • Log in

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

Entry Meta

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags