Advertisement
GochiSiyan

author page

Mar 1st, 2021
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. add_filter('bp_core_get_user_domain',function ($link,$author_id,$author_nicename){
  2. global $wp_rewrite;
  3. $auth_ID = (int) $author_id;
  4. $link = $wp_rewrite->get_author_permastruct();
  5.  
  6. if ( empty( $link ) ) {
  7. $file = home_url( '/' );
  8. $link = $file . '?author=' . $auth_ID;
  9. } else {
  10. if ( '' === $author_nicename ) {
  11. $user = get_userdata( $author_id );
  12. if ( ! empty( $user->user_nicename ) ) {
  13. $author_nicename = $user->user_nicename;
  14. }
  15. }
  16. $link = str_replace( '%author%', $author_nicename, $link );
  17. $link = home_url( user_trailingslashit( $link ) );
  18. }
  19. // error_log($link);
  20. return $link;
  21. },9999999,3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement