1

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?

  • Hi, you can take a look into this link or this one if you want to track the publisher of a post. – Jack Johansson Jan 22 '17 at 18:29
  • Thanks Jack for the reply. But this does not give me the existing post old author name/id..any more suggestion? – 1991wp Jan 22 '17 at 18:39
  • I'm because the old authors are overwritten. You can use this feature for future posts. – Jack Johansson Jan 22 '17 at 18:43
  • sorry Jack I am not getting what he explained any other solution which could be done in functions.php file? – 1991wp Jan 22 '17 at 18:48
  • You can try what @fergbrain explained in his answer, if you haven't deleted the revisions you might be able to retrieve the data. If it didn't help, then i will post an answer for further use. – Jack Johansson Jan 22 '17 at 18:53
1

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 the_modified_author(); or get_the_modified_author();.

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

  • You are most welcome. – Jack Johansson Jan 22 '17 at 19:36
  • I think this could be achieved without plugin too – 1991wp Jan 22 '17 at 19:37
  • Yes for sure, but plugin is the easiest way, and needs no extra coding. – Jack Johansson Jan 22 '17 at 19:40
1

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.

  • Sorry fergbrain this is not helping out.. – 1991wp Jan 22 '17 at 18:58
  • Can you be more specific? – fergbrain Jan 22 '17 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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