[wp-hackers] save_post action done twice

Scott Bressler sbressler at gmail.com
Fri Oct 22 10:52:40 UTC 2010


Ah, I see, one is a of type 'revision' and the other of type 'post'. Thanks!

Is save_post better than edit_post? What cases would edit_post miss?

On Fri, Oct 22, 2010 at 3:50 AM, scribu <mail at scribu.net> wrote:

> On Fri, Oct 22, 2010 at 1:28 PM, Scott Bressler <sbressler at gmail.com>
> wrote:
>
> > It seems that in hooking into the save_post action for saving the data in
> a
> > custom meta-box, my callback is being called twice when either saving a
> > draft post or updating a published post. If I instead hook into
> edit_post,
> > my callback is only called once.
> >
> > Is this "double-calling" behavior with save_post expected? Should I be
> > hooking into edit_post instead?
> >
>
> Yes, it's expected. You should be checking the post_type at the beginning
> of
> your callback.
> _______________________________________________
> 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