Permalink
Browse files

Display Proper Author Information For Posts != $post->ID

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...
1 parent e98ca0b commit 6fbf1dc074c5591b8c15d4a630024f5b27a5bd4f @pcrumm pcrumm committed May 26, 2014
Showing with 1 addition and 1 deletion.
  1. +1 −1 template-tags.php
View
@@ -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 ) ) );

0 comments on commit 6fbf1dc

Please sign in to comment.