By default, author profiles are accessible using the pre-defined slug yourwebsite.com/author/name. What if there will be a case when you want to use the term “author-profile” or any other instead of just “author” in the URL. Pasting the following code in your theme’s functions.php file will change author URL base. Remember to replace profile on line 4 by any slug you like.
1 2 3 4 5 6 | add_action('init', 'cng_author_base'); function cng_author_base() { global $wp_rewrite; $author_slug = 'profile'; // change slug name $wp_rewrite->author_base = $author_slug; } |
Snippet Source/Credit: Kevin Chard