2

I'm looking at the wordpress list of actions and trying to find an action that is called when a post is restored from the trash but cannot find one. Does anyone know if it exists?

5

There are multiple actions. Listed in order of appearance with their parameters:

  • untrash_post - (int) $post_id // before restoring
  • transition_post_status - (string) $new_status, 'trash', (object) $post
  • trash_to_{$new_status} - (object) $post // useful to address a special trash to status action
  • untrash_post_comments - (int) $post_id // before associated comments are untrashed
  • untrashed_post_comments - (int) $post_id // after associated comments are untrashed
  • untrashed_post - (int) $post_id // after restoring

Related answer with more statuses: Execute function when post is published

  • great answer. The particular one I was looking for was untrashed_post. – DiverseAndRemote.com Jan 3 '13 at 23:13
0

I found it in wp-includes/post.php and its called untrashed_post. For some reason wordpress chose not to include it on their action reference page at http://codex.wordpress.org/Plugin_API/Action_Reference

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.