[wp-trac] [WordPress Trac] #48410: `wp_insert_post()` can result in duplicate post data

WordPress Trac noreply at wordpress.org
Wed Oct 23 15:04:14 UTC 2019


#48410: `wp_insert_post()` can result in duplicate post data
--------------------------+-----------------------------
 Reporter:  henry.wright  |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 If 2 identical calls to `wp_insert_post()` are made close enough together,
 2 posts are added to the database instead of 1. These posts differ by post
 ID only. The slug for example is the same.

 This seems to happen because `wp_insert_post()` does a fair amount of
 processing before the database write takes place. The check to determine
 if a post already exists can be _stale_ at the point of insertion.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48410>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list