[wp-trac] [WordPress Trac] #48903: Drafts or pending posts overwrites existing published post with same url

WordPress Trac noreply at wordpress.org
Fri Dec 6 16:33:57 UTC 2019


#48903: Drafts or pending posts overwrites existing published post with same url
--------------------------+-----------------------------
 Reporter:  uatania       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Permalinks    |    Version:  5.3
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 The creation of a draft with post_name set to as an existing post will
 prevent the reachability of the older until the pubblication of the new
 one. The cause of the issue is that the function ''wp_unique_post_slug''
 only acts if the post isn't in the status of draft or pending so in the
 database will be stored two posts with the same post_name. In the frontend
 side (in a installation with permastruct set to /%postname%/) the executed
 query is

 {{{
 SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_name =
 'example' AND wp_posts.post_type = 'post' ORDER BY wp_posts.post_date DESC
 }}}

 This query will return 2 posts and the wordpress considers the most recent
 (the draft) so the url returns 404.

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


More information about the wp-trac mailing list