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

Peter Adams peter at oncefuture.com
Tue Aug 3 17:55:29 UTC 2010

Picking this back up...

This hook seems to get fired during auto-saves. Is there a way to detect auto-saves when a post's status is transitioned?

Looking for a way to tease out true post "edits".


On May 6, 2010, at 1:48 PM, Andrew Nacin wrote:

> wp_transition_post_status().
> On Thu, May 6, 2010 at 4:41 PM, Peter Adams <peter at oncefuture.com> wrote:
>> 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-
> _______________________________________________
> 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