Rewrite Guest Author’s Name with Custom Fields
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
<!--
Now many blogs are publishing other authors also known as guest authors. A lot of these guest authors are one time writers. In this scenario, it is not feasible to create user accounts for them. This trick will let you replace the author name to guest author with the use of a custom field. Simply paste the code below:
-->
add_filter( 'the_author', 'guest_author_name' );
add_filter( 'get_the_author_display_name', 'guest_author_name' );
function guest_author_name( $name ) {
global $post;
$author = get_post_meta( $post->ID, 'guest-author', true );
if ( $author )
$name = $author;
return $name;
}
<!-- Now every time there is a guest post, simply add the custom field guest-author. -->