Advertisement
rakeshr

How to Rewrite Guest Author Name with Custom Fields in WordP

Nov 28th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.27 KB | None | 0 0
  1. add_filter( 'the_author', 'guest_author_name' );
  2. add_filter( 'get_the_author_display_name', 'guest_author_name' );
  3. function guest_author_name( $name ) {
  4. global $post;
  5. $author = get_post_meta( $post->ID, 'author', true );
  6. if ( $author )
  7. $name = $author;
  8. return $name;
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement