[wp-hackers] Single Action hook for _new_ posts of any type?

Peter Adams peter at oncefuture.com
Thu May 6 20:41:09 UTC 2010


Folks -

I'm looking to get two hooks to fire when:

A) a user creates a _new_ post of any type
B) when a user edits a post of any type

Found that "edit_post" is perfect for case B but that the "save_post" and "wp_insert_post" hooks are problematic for A because they also fire when  "edit_post"  fires (as they should).

I was going to turn to a variable hook like "publish_post" but  since the hook name uses $post->post_type in the construction of the name I would have to setup hook ahead of time or all different post types - which isn't going to work for posts with custom types that i don't know about.

So my question is...

is there a single hook like "edit_post" that is fired ONLY when a new post of any type is created and passes the post object as or an id as a param so i can get at post's type?

Thanks,

-P-

--
Peter Adams
http://www.openwebanalytics.com


More information about the wp-hackers mailing list