Ticket #4620 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

Post status transition actions

Reported by: ryan Assigned to: ryan
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

status_transit.diff (8.3 kB) - added by ryan on 07/11/07 23:20:55.

Change History

07/11/07 23:20:55 changed by ryan

  • attachment status_transit.diff added.

07/12/07 16:02:50 changed by ryan

see #5797

07/12/07 16:03:07 changed by ryan

[5797] rather

07/27/07 18:10:49 changed by Otto42

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?

07/30/07 16:39:32 changed by markjaquith

  • status changed from new to closed.
  • resolution set to fixed.

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.