How to change the author page URL

I call into WP to the get_author_posts_url function to get the URL for the authors page. It has this filter that you can use to adjusted the path
/**
* Filters 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 );

so you can change the path using code like this

add_filter( 'author_link', 'author_link' );

function author_link( $link ){

$link = str_replace( ‘/blog/author/’, ‘/vendor/’, $link );
return $link;
}

%d bloggers like this: