How to change author base without front

This is the best solution I have come up with but I welcome better ways:

function change_author_permalinks() {
    global $wp_rewrite;
    $wp_rewrite->author_base="connect/member";
    $wp_rewrite->author_structure = "https://wordpress.stackexchange.com/" . $wp_rewrite->author_base . '/%author%';
    add_rewrite_rule('connect/member/([^/]+)/?$', 'index.php?author_name=$matches[1]', 'top');
}
add_action('init','change_author_permalinks');

Leave a Comment