add_rewrite_rule – Additional subpages for author pages

Which works great when going to this URL:

http://mylocalsite.site/?author=1&author_view=pinboard

Yes, and that is because in that URL, the author value is a user ID.

But in the “pretty” version of that URL (e.g. http://mylocalsite.site/author/admin/pinboard), WordPress uses the user’s “nice name” (from the user_nicename column in the wp_users table) which by default is the same as the username (from the user_login column in the users table).

Therefore, in your rewrite rule’s query (the 2nd parameter for add_rewrite_rule()), you need to use author_name and not author:

add_rewrite_rule(
    $author_base . '/([^/]*)/([^/]*)',
    'index.php?author_name=$matches[1]&author_view=$matches[2]', // use author_name
//  'index.php?author=$matches[1]&author_view=$matches[2]',      // and not "author"
    'top'
);

That way, is_author() would return true on the page (with the author_view part in the URL) and thus, you’d not need to hook on template_redirect because the author template like author.php would be loaded correctly for you.

So in summary, just correct the query argument’s name and your rule would work without giving you those errors. 🙂 (But be sure to flush the rewrite rules — just visit the permalink settings page)