[wp-hackers] Odd wp_insert_post hook behavior MU 2.9.1.1

Andrew Nacin wp at andrewnacin.com
Thu Apr 1 03:37:17 UTC 2010


>
> The post inserts as expected, but the hook does not run.  However, the hook
> is run upon delete, and apparently, doesn't pass $post.
>

It sounds like you simply don't have your callback in place before
wp_insert_post() gets fired. wp_insert_post() is returning a post_id, which
it only does after it has run the action (otherwise, it would return 0 or a
WP_Error object).

You can also try using something like
add_action( 'all', create_function( '', 'var_dump( current_filter() );' ) );
Which would fire off the hooks being run.


More information about the wp-hackers mailing list