If you have a WordPress website that is not a traditional blog or magazine style website, you may want to change the standard ‘/author/’ that’s in the URL for users of your site. This piece of code takes care of that.
In this particular snippet, the ‘author base’ is set to ‘/profile/’, but you can change it to anything you like.
function change_author_permalinks() {
global $wp_rewrite;
$wp_rewrite->author_base = 'profile';
$wp_rewrite->author_structure = "/" . $wp_rewrite->author_base . '/%author%';
add_rewrite_rule('profile/([^/]+)/?$', 'index.php?author_name=$matches[1]', 'top');
}
add_action('init','change_author_permalinks');