[wp-trac] [WordPress Trac] #52422: Create a draft with the same slug as an existing post, the existing post will be 404.

WordPress Trac noreply at wordpress.org
Wed Aug 3 09:01:20 UTC 2022


#52422: Create a draft with the same slug as an existing post, the existing post
will be 404.
-------------------------------------------------+-------------------------
 Reporter:  Toro_Unit                            |       Owner:  audrasjb
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.1
Component:  Posts, Post Types                    |     Version:
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests has-        |     Focuses:
  testing-info early dev-feedback commit         |
-------------------------------------------------+-------------------------
Changes (by audrasjb):

 * status:  accepted => closed
 * resolution:   => fixed


Comment:

 In [changeset:"53813" 53813]:
 {{{
 #!CommitTicketReference repository="" revision="53813"
 Posts, Post Types: Force unique slugs for draft posts.

 This fixes a behavior where a draft created with the same slug as an
 existing post would set the existing post to a 404.

 `wp_unique_post_slug()` returns the same slug for 'draft' or 'pending'
 posts, so to ensure that a unique slug is generated, this changeset adds
 the post data with the 'publish' status to `wp_unique_post_slug()`.

 Props Toro_Unit, h2ham, peterwilsoncc, costdev, antonvlasenko, azaozz,
 ironprogrammer, audrasjb, hellofromTonya.
 Fixes #52422.
 }}}

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


More information about the wp-trac mailing list