Skip to content

Instantly share code, notes, and snippets.

@LordZombi
Created July 15, 2013 14:03
Show Gist options
  • Save LordZombi/6000168 to your computer and use it in GitHub Desktop.
Save LordZombi/6000168 to your computer and use it in GitHub Desktop.
Wordpress get all post's editors.
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