Skip to content

Commit

Permalink
Display Proper Author Information For Posts != $post->ID
Browse files Browse the repository at this point in the history
When get_coauthors() is called with a post ID (`$post_id`) specified, `$post->ID`'s author is displayed if `$post_id` is created by a "real" user (non-coauthor), even if `$post_id != $post->ID`.

This corrects this functionality, and will display the current post's author if and only if `$post_id == $post->ID`.
  • Loading branch information
Phillip Crumm committed May 26, 2014
1 parent e98ca0b commit 6fbf1dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion template-tags.php
Expand Up @@ -22,7 +22,7 @@ function get_coauthors( $post_id = 0 ) {
$coauthors[] = $post_author;
}
} else if ( !$coauthors_plus->force_guest_authors ) {
if ( $post ) {
if ( $post && $post_id == $post->ID ) {
$post_author = get_userdata( $post->post_author );
} else {
$post_author = get_userdata( $wpdb->get_var( $wpdb->prepare("SELECT post_author FROM $wpdb->posts WHERE ID = %d", $post_id ) ) );
Expand Down

0 comments on commit 6fbf1dc

Please sign in to comment.