Make WordPress Core

Opened 12 months ago

Closed 4 months ago

#55789 closed defect (bug) (wontfix)

Why auto increment post id without created Post/Page

Reported by: sumitsingh's profile sumitsingh Owned by:
Milestone: Priority: normal
Severity: major Version:
Component: Posts, Post Types Keywords: has-screenshots close
Focuses: administration Cc:

Description

Hey,

I am trying to create page/post and then i don’t want to create then go back and come again to create Page/Post then automatically increase post ID.

Here quick video-

https://www.loom.com/share/26ee0a4301ad4e3cb1027d92268c764e

Change History (9)

#1 @sumitsingh
12 months ago

I have checked and also updated in database without saved page?
https://www.loom.com/share/33d4915703704147b4433c04d3340fd9

#2 @sumitsingh
12 months ago

  • Component changed from General to Posts, Post Types
  • Severity changed from normal to major

#3 @costdev
12 months ago

  • Focuses coding-standards removed
  • Version trunk deleted

Removing trunk as the Version as this behaviour exists in 4.0.35 (I haven't tested with earlier versions).

#4 @sumitsingh
12 months ago

Hi @costdev ,

I have checked 5.9 version and there also heppning same things and auomatically increase post ID number on database.

i think we need to resolve this things ASP.

#5 follow-up: @costdev
12 months ago

@sumitsingh That's correct about WordPress 5.9. I have observed this behaviour in all WordPress versions from 4.0.35 to 6.0-RC4, but haven't tested this in versions earlier than 4.0.35.

#6 in reply to: ↑ 5 @sumitsingh
12 months ago

@costdev I have observed becuase i have one big blog site with Multi langugae there there almost 100k blog but Post ID is very long on DB. Becuase daily lot's of guys author come for add post on site then he close without created post then increasing post by on DB.

Replying to costdev:

@sumitsingh That's correct about WordPress 5.9. I have observed this behaviour in all WordPress versions from 4.0.35 to 6.0-RC4, but haven't tested this in versions earlier than 4.0.35.

Last edited 12 months ago by sumitsingh (previous) (diff)

#7 @SergeyBiryukov
12 months ago

  • Focuses javascript rest-api removed
  • Keywords close added
  • Summary changed from Why auto increament post id whithout created Post/Page in WordPress 6.0-RC4 to Why auto increment post id whithout created Post/Page

Hi there, thanks for the ticket!

This has come up a few times 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 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: How to: Avoid a bunch of useless Auto Draft ID entries related in posts table and disable autosave feature in 'post-new.php'?

Last edited 12 months ago by SergeyBiryukov (previous) (diff)

#8 @SergeyBiryukov
12 months ago

  • Summary changed from Why auto increment post id whithout created Post/Page to Why auto increment post id without created Post/Page

#9 @JeffPaul
4 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.