Created
July 15, 2013 14:03
-
-
Save LordZombi/6000168 to your computer and use it in GitHub Desktop.
Wordpress get all post's editors.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getPostAuthors() { | |
global $wpdb; | |
$authors = array(); | |
$results = $wpdb->get_results( $wpdb->prepare("SELECT post_author FROM $wpdb->posts WHERE (post_type = '%s' AND ID = %d) OR (post_type = 'revision' AND post_parent = %d) GROUP BY post_author", get_post_type( get_the_ID() ), get_the_ID(), get_the_ID() ) ); | |
foreach ($results as $row) { | |
if (isset($coma)) { | |
echo $coma; | |
} else { | |
$coma = ', '; | |
} | |
echo '<a href="mailto:' . get_the_author_meta('user_email', $row->post_author) . '"> ' . get_the_author_meta('display_name', $row->post_author) . '</a>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment