author_link filter not work correctly
Question
i want to change author link page.
by default it’s:
site.com/author/user_nice_name
but i want change it to:
site.com/teacher/user_nice_name
i used this code and it worked, but when i click on the user link i get 404 error.
function custom_author_link($link, $author_id, $author_nicename) {
$author_nicename = get_the_author_meta( 'user_nicename' );
$link = home_url( user_trailingslashit( 'teacher' ) ) . $author_nicename;
return $link;
}
add_filter('author_link', 'custom_author_link', 10, 3);
0
author, links
4 years
2020-04-21T09:10:58-05:00
2020-04-21T09:10:58-05:00 0 Answers
99 views
0
Leave an answer