Opened 6 years ago
Closed 6 years ago
#4620 closed defect (bug) (fixed)
Post status transition actions
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 2.3 |
| Component: | Administration | Version: | 2.3 |
| Severity: | normal | Keywords: | status workflow |
| Cc: |
Description
Add post status transition actions so that plugins can hook into workflow. Example actions:
- draft_to_publish
- pending_to_publish
- private_to_publish
- future_to_publish
- pending_to_draft
etc.
Also add hooks announcing new status.
- draft_post
- draft_page
- publish_post
- publish_page
- pending_post
- future_post
etc.
Finally, add a catch-all transition_post_status hook that passes the old and new status.
Attachments (1)
Change History (5)
publish_post is being added in default_filters, but not being called by anything. There's no do_action('publish_post') in all of trunk.
Was this supposed to do something?
comment:4
markjaquith — 6 years ago
- Resolution set to fixed
- Status changed from new to closed
It's dynamically built... that's why you couldn't find it:
function wp_transition_post_status($new_status, $old_status, $post) {
if ( $new_status != $old_status ) {
do_action('transition_post_status', $new_status, $old_status, $post);
do_action("${old_status}_to_$new_status", $post);
}
do_action("${new_status}_$post->post_type", $post->ID, $post);
}
This is really cool, BTW.
Note: See
TracTickets for help on using
tickets.

see #5797