[wp-hackers] Publish post action - for Custom Post Types

Michael D Adams mda at blogwaffe.com
Tue Sep 20 19:53:00 UTC 2011


On Tue, Sep 20, 2011 at 5:19 AM, Robert Lusby <nanogwp at gmail.com> wrote:
> The "public_post" action only triggers when the "post" type is published
> (obviously).
>
> You can also the action "publish_customposttype", to run when a custom post
> type is published.
>
> However ....
>
> Which action should you use to detect when ANY post type (post, page,
> custom) is published??

You can use the transition_post_status action, which passes:
$new_status, $old_status, $post as its parameters.

http://core.trac.wordpress.org/browser/tags/3.2.1/wp-includes/post.php#L2958


More information about the wp-hackers mailing list