Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

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

share|improve this answer
    
great answer. The particular one I was looking for was untrashed_post. –  Omar Jackman Jan 3 '13 at 23:13

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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