WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#13001 closed enhancement (invalid)

Action Hook for change post status

Reported by: Angeloverona Owned by:
Milestone: Priority: high
Severity: normal Version: 3.0
Component: General Keywords: hook action pending
Focuses: Cc:

Description

We have post_publish hook to action of publish, but it more as needed, also hooks for pending for example to handle action after the button "submit to review" is pressed. Or post is saved as a draft.

Change History (3)

comment:1 mikeschinkel4 years ago

  • Cc mikeschinkel@… added

comment:2 jamescollins4 years ago

  • Milestone 3.0 deleted
  • Resolution set to invalid
  • Status changed from new to closed

I suggest you take a look at the wp_transition_post_status() function and associated transition_post_status hook in wp-includes/post.php.

This hook allows you to see the new status, the old status, and the post data.

comment:3 nacin4 years ago

2616  function wp_transition_post_status($new_status, $old_status, $post) {
2617      do_action('transition_post_status', $new_status, $old_status, $post);
2618      do_action("{$old_status}_to_$new_status", $post);
2619      do_action("{$new_status}_$post->post_type", $post->ID, $post);
2620  }
Note: See TracTickets for help on using tickets.