[wp-trac] [WordPress Trac] #55789: Why auto increment post id whithout created Post/Page (was: Why auto increament post id whithout created Post/Page in WordPress 6.0-RC4)

WordPress Trac noreply at wordpress.org
Mon May 23 15:43:59 UTC 2022


#55789: Why auto increment post id whithout created Post/Page
-----------------------------------+------------------------------
 Reporter:  sumitsingh             |       Owner:  (none)
     Type:  defect (bug)           |      Status:  new
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  Posts, Post Types      |     Version:
 Severity:  major                  |  Resolution:
 Keywords:  has-screenshots close  |     Focuses:  administration
-----------------------------------+------------------------------
Changes (by SergeyBiryukov):

 * keywords:  has-screenshots => has-screenshots close
 * focuses:  javascript, administration, rest-api => administration


Comment:

 Hi there, thanks for the ticket!

 This has come up a few before: #14588, #18800, #19079, #19310, #29431,
 most recently in #33764.

 Auto-incrementing post IDs is intended functionality and an integral part
 of WordPress' auto-draft implementation since WordPress 3.0: [12987] /
 #11889. The goal is to always have a post ID to work with and avoid race
 conditions.

 Quoting the explanations from an [http://lists.automattic.com/pipermail
 /wp-hackers/2012-February/042398.html old wp-hackers thread], via
 comment:1:ticket:33764:

 > Auto-drafts exist because of the fact that multiple users can create new
 posts at the same time. If two people enter post-new at roughly the same
 moment, then have their first autosaves occur nearly simultaneously, then
 there is a race condition that can cause one of them to get back the wrong
 post ID, which will cause a post to be overwritten/lost when they then
 continue editing the post.
 >
 > The auto-draft creates the post and gets the ID of the new post before
 the editing screen is displayed, thus preventing two simultaneous authors
 from accidentally having the same post ID in the data in their browser.

 Furthermore:

 > Auto-drafts are automatically deleted after 7 days of going unused.
 They're self-cleaning, basically. '''No need to worry about them.'''
 >
 > They also go away when the first auto-save occurs while writing a new
 post.

 Reference: [https://wordpress.stackexchange.com/questions/44352/how-to-
 avoid-a-bunch-of-useless-auto-draft-id-entries-related-in-posts-table-an
 How to: Avoid a bunch of useless Auto Draft ID entries related in posts
 table and disable autosave feature in 'post-new.php'?]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55789#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list