[wp-hackers] possible to get next postid before publish?

John Blackbourn johnbillion+wp at gmail.com
Sat Dec 17 21:53:03 UTC 2011


On 17 December 2011 21:31, Jason LeVan <jason at codeclarified.com> wrote:
> I may be incorrect with this, but I don't believe that is accurate - auto
> saves before posting each receive an ID I beleve, not to mention another
> user on the site at the same time.
>
> Sorry if I'm off on that, but I don't think the post's ID is set until save

William is right. Since version 3.0 WordPress creates a post with
auto-draft status whenever you visit the new post screen. The ID of
the auto-draft is used when the post is saved, so it can be reliably
used (eg. in meta boxes) on the new post screen before the post is
even saved by the user.


More information about the wp-hackers mailing list