[wp-hackers] Custom field for enclosures

Otto otto at ottodestruct.com
Fri Mar 19 13:21:36 UTC 2010

This all happens in the wp_transition_post_status function. Which
looks like this:

function wp_transition_post_status($new_status, $old_status, $post) {
	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);

That last one is what kicks off publish_post (status + post type).

Careful though, publish_post happens on any post update (if the post
is published). If you want to only catch the first publish, then you'd
want to hook to transition_post_status and compare the new and old
statuses that you get instead.


On Fri, Mar 19, 2010 at 2:42 AM, Karl Wångstedt <maillist at wangstedt.net> wrote:
> That makes sense. I got a bit confused there for a while. :)
> OK. I'll go open a ticket right away. Thank's for the help
> Karl Wångstedt
> 19 mar 2010 kl. 00.53 skrev John Blackbourn:
>> If you're grepping for 'publish_post' you probably won't find it. IIRC
>> it's now written as "publish_$post_type" so there is a hook for every
>> post type. Haven't got an install handy to check that though.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list