• barlas

    (@barlas)


    I was just making a simple plugin, that should show name of guest author instead of real author, if there is custom field set, but when I activate the plugin it shows name of author (or guest author) twice on every post. Here’s the code:

    function guest_author( $author = '' ) {
    	$guestName = get_post_custom_values( "guestName" );
    
    	if ( $guestName ) {
    		echo $guestName[0];
    	} else {
    		echo $author;
    	}
    }
    
    add_filter ( the_author, guest_author );

    Commenting echo statement doesn’t give any output, otherwise it prints them (guestName or author, depending on the if condition) twice, which most probably means for some reason the function is called two times, instead of one.

    Any ideas?

  • The topic ‘author name displayed twice’ is closed to new replies.