Advertisement
arie_cristianD

change the author link

Mar 25th, 2024 (edited)
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. add_filter( 'author_link', 'jeg_modify_author_link', 10, 3 );
  2. function jeg_modify_author_link( $link, $author_id, $author_nicename ) {
  3.  
  4.     /* get the real username */
  5.     $username = get_userdata( $author_id );
  6.     $username = $username->data->user_login;
  7.    
  8.     /*
  9.     change local with your author username
  10.         change the test-page with your page link
  11.         you can add more if statement for all you author
  12.     */
  13.     if ( 'local' === $username ) {
  14.         $link = get_home_url() . '/test-page';
  15.     }
  16.     if ( 'local' === $username ) {
  17.         $link = get_home_url() . '/test-page';
  18.     }
  19.     if ( 'local' === $username ) {
  20.         $link = get_home_url() . '/test-page';
  21.     }
  22.     return $link;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement