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?

2 Answers
2

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

Leave a Reply

Your email address will not be published. Required fields are marked *