Make WordPress Core

Opened 16 months ago

Closed 16 months ago

Last modified 16 months ago

#56963 closed defect (bug) (invalid)

Creating new post is using a pre-existing post id

Reported by: danielcho's profile danielcho Owned by:
Milestone: Priority: normal
Severity: major Version: 6.0.3
Component: Posts, Post Types Keywords:
Focuses: Cc:

Description

We are having an issue with our site where when a user creates multiple new posts in a short time frame, the post id for all of these new posts is all the same, resulting in lost data and overall issues.
From what we're seeing, this issue extends past a single tab/instance of the site being open, where even opening a new tab or window will still lead to the same post id being used.
So if 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.
To get a new post id, it seems the only ways are to refresh the page specifically on the blank new post page or to create the new post in a different browser or in incognito mode.
Ideally as many of our users need to be able to work on multiple posts at the same time, we would like for them to not worry about the possibility of overwriting their work on one post when creating a new one.
We didn't notice this issue until we upgraded our wordpress version to 6.0.3, and personally I didn't see this issue on my local version of the site while I was on a lower version, but began to see it once I also updated to 6.0.3, so we suspect it might be due to the latest version somehow.

Change History (3)

#1 follow-up: @azaozz
16 months ago

  • Keywords reporter-feedback added

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 can be seen by other users on the Posts screen, 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 posts very fast. Posts by different users can be made concurrently.)

Last edited 16 months ago by azaozz (previous) (diff)

#2 in reply to: ↑ 1 @danielcho
16 months ago

  • Resolution set to invalid
  • Status changed from new to closed

Replying to azaozz:

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 can be seen by other users on the Posts screen, 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 posts very fast. Posts by different users can be made concurrently.)

I'm so sorry, we actually found the cause of the issue was a plugin that we missed originally while testing with plugins off. I'll close the ticket now. Sorry again!

#3 @SergeyBiryukov
16 months ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted

No worries, thanks for the follow-up!

Note: See TracTickets for help on using tickets.