How to custom change author base without $this->front?

You’re close, but you don’t need the add_rewrite_rule call.

add_action('init', 'wpse82004_init');
function wpse82004_init()
{
    global $wp_rewrite;
    $wp_rewrite->author_base="u";
    $wp_rewrite->author_structure="https://wordpress.stackexchange.com/" . $wp_rewrite->author_base . '/%author%';
}

After that’s in place, just re-save permalinks.

Here’s a plugin to put an option on your permalinks page to do this.

Leave a Comment