[wp-trac] [WordPress Trac] #56963: Creating new post is using a pre-existing post id

WordPress Trac noreply at wordpress.org
Wed Nov 2 17:33:17 UTC 2022


#56963: Creating new post is using a pre-existing post id
-------------------------------+------------------------------
 Reporter:  danielcho          |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:  6.0.3
 Severity:  major              |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------
Changes (by azaozz):

 * keywords:   => reporter-feedback


Comment:

 > a user creates multiple new posts in a short time frame, the post id for
 all of these new posts is all the same
 > ...
 > a user creates a new post (either just opening the page and leaving or
 saving and publishing it), and then tries to create another new post
 (either in a new tab or in the same tab) the post id for the second new
 post will remain the same as the first new post

 Could you confirm if that happens when the user creates the second post
 after the first has been published (assuming there was some content in it
 or at least a title)?

 The way new posts are created is as follows:
 1. User opens the New Post screen => WP creates a special post type (auto-
 draft) and inserts it in the DB.
 2. User adds a title or starts to type in the new post => WP auto-saves
 the post and converts it to a standard draft (removes the auto-draft
 type). At this point the post in the DB can be seen by other users, they
 can "take over" and edit it, etc.

 Also posts with no title and no content are considered "invalid" or "user
 error". These happen sometimes when a user opens the New Post screen but
 then goes away or just quits the browser. Because of that opening several
 New Post screens in separate tabs by the same user (without entering
 anything in them) may reuse the same auto-draft (same post ID). Guessing
 that at the back-end that looks like the user reloading the same screen
 several times.

 A better workflow would be if a draft is saved for each new post (by
 clicking the button) before another is started. Then WP will change the
 type of the first post to a standard draft. (Of course this only applies
 when the same user wants to create many new post very fast. Posts by
 different users can be made concurrently.)

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


More information about the wp-trac mailing list