WordPress SQL query to get who last edited posts

I want to get who last edited posts. I’ve got this query:

SELECT meta_value, post_title, post_modified
FROM wp_posts
LEFT JOIN wp_postmeta ON wp_posts.ID=wp_postmeta.post_id
WHERE wp_postmeta.meta_key='_edit_last'

In this query the result of meta_value is user ID, but I want to get user name (user_login from wp_users table). How can I do that?

Related posts

Leave a Reply

1 comment

  1. I think your answer is like this:

    SELECT meta_value, post_title, post_modified, wp_users.user_login
    FROM wp_posts
        LEFT JOIN wp_postmeta ON wp_posts.ID=wp_postmeta.post_id
        LEFT JOIN wp_users ON wp_users.ID=meta_value
    WHERE wp_postmeta.meta_key='_edit_last'