Snippets: Alter Author Bio URL

/**
* Example showing how to change author bio URL
*
* @link http://wpexplorer-themes.com/total/snippets/alter-author-bio-url/
* @see  Total/author-bio.php
*
*/
function myprefix_author_bio_url( $data ) {

	// Get global post
	global $post;

	// Add custom URL for post author with ID of 1
	if ( 1 == $post->post_author ) {
		$url = 'CUSTOM URL';
	}

	// Use posts url for all other authors
	else {
		$url = get_author_posts_url( $post->post_author );
	}

	// Alter the post url for the author bio
	$data['posts_url'] = $url;

	// Return data
	return $data;

}
add_filter( 'wpex_post_author_bio_data', 'myprefix_author_bio_url' );

Snippet Type: PHP

Posted Under: Blog

All PHP snippets should be added via a child theme's functions.php file.