/**
* 修改url重写后的作者存档页的链接变量
*/
add_filter('author_link', 'author_link', 10, 2);
function author_link( $link, $author_id) {
global $wp_rewrite;
$author_id = (int) $author_id;
$link = $wp_rewrite->get_author_permastruct();
if ( empty($link) ) {
$file = home_url( '/' );
$link = $file . '?author=' . $author_id;
} else {
$link = str_replace('%author%', $author_id, $link);
$link = home_url( user_trailingslashit( $link ) );
}
return $link;
}