WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I call the usernames of people that have edited a post?

I know I can use get_the_modified_time to display the time the post was last modified, is the same possible with the list of users that edited it?

share|improve this question
up vote 5 down vote accepted

The WordPress function get_the_modified_author() will give you the author who last edited the current post.

But if you want to list all the users that have edit the current post, you could try:

function get_the_modified_authors_wpse_99226(){
    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){
          $authors[] =  get_the_author_meta('display_name', $row->post_author );
    return implode(", ", $authors);

This function will give you a distinct comma seperated list of the users that have edit the current post (i.e. their display name). This should also work with custom post types.

share|improve this answer
excellent thank you so much! all I need to do now is wrap this in some sort of 'if post has been edited'. Thanks! :) – ameeromar May 13 '13 at 11:19
to do this I used this code '<?php $u_time = get_the_time(‘U’); $u_modified_time = get_the_modified_time(‘U’); if ($u_time !== $u_modified_time) { echo get_the_modified_authors_wpse_99226(); }else echo(“Never Updated.”);?>' – ameeromar May 13 '13 at 12:57
ok great, thanks for sharing your solution (though this would be better served as a new question). Please mark the question as accepted if it solved your problems, thanks – birgire May 13 '13 at 13:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.