8

Someone moved a very important page on my website into the trash, and I do not know who did it! It was not deleted permanently so I don't need to worry, in that sense.

The revisions, when I restored it, show that someone edited it 3 days prior to today, so it could have been them, but I can't be sure.

Does WP keep track of who clicks the trash button? If not, I presume I'd have to write a custom script to hook onto the trash button, when clicked.

2
  • 1
    Now would be an excellent time to set up a regular backup, code and database, and put together a recovery plan. Jun 20, 2014 at 18:08
  • @AndrewBartel I've got backupbuddy running daily, just in case. Jun 20, 2014 at 19:05

4 Answers 4

5

By default, no, WordPress doesn't keep track of who changes post statuses (at least that I can see).

you can hook into transition_post_status and log the user id.

    add_action( 'transition_post_status', 'wwm_transition_post_status', 10, 3 );

    function wwm_transition_post_status( $new_status, $old_status, $post ) {
     if ( 'trash' == $new_status ) {
      $uid = get_current_user_id();
      //somehow or another log the $uid with the $post->ID
     }
    }
1

No, natively WordPress does not log any activity. While plugins for it exist, they won't work retroactively.

However don't forget that any action taken in WordPress is technically a HTTP request, such as page load, form submit, or Ajax request.

These are often logged pretty thoroughly in web server's access log and if available it's pretty realistic to reconstruct action that happened and details like user's IP from them.

1

WP can not do it, but you can go to the server logs and find the user's IP. It may take some effort and success is not guaranteed but this is the only possible way. Will's answer will help you in future mistakes.

Finding a user based on their IP is not usually hard especially if the number of authors is limited.

0

There is a free plugin called Stream that will make your life much easier. Search within the WordPress plugins page. It logs all changes to posts and who is responsible for them.

1
  • First of all, recommending a plugin is not a great answer, actualy not done here! Secondly, if you want your data shared with a 3rd party company (in the cloud theirs) have fun and tell your users also why you share that info with them. If privacy is at least meaning some to you as website owner I would say, stay away from plugins like Stream!
    – Charles
    Aug 14, 2015 at 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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