I have created the post by user (A), later I changed the user of the post to (B), Now I want to find out who initially created the post i.e. user (A) who originally created it.
How can I achieve this?
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.Sign up to join this community
There are several approaches to your issue.
1- Getting the original author inside a loop
To retrieve the original author of a post inside a loop, you can use
get_the_author(); to get the username of the author or
$post->post_author(); to get his/her user id. If you wish to get the revisor's username or id, you can use
2- In the back-end
If you want to have this result in the back-end (view the original author in the admin panel), you can use the following plugin made specifically for this purpose.
Published By plugin made by Scott reilly
The easiest way is to sleuth through the mySQL database. Every change to a post is saved. Run the following query using phpMyAdmin (or your mySQL tool of choice):
SELECT wp_users.ID, wp_users.user_nicename, wp_posts.post_title FROM wp_posts LEFT JOIN wp_users ON wp_posts.post_author = wp_users.ID WHERE post_parent = 1234
1234 is the current post_id of the post you want to find.
This will display the user id, user nicename, and title of the post for the prior revisions.