[wp-trac] [WordPress Trac] #61996: Slug Conflict When a Published and Draft Page Share post_name

WordPress Trac noreply at wordpress.org
Sun Aug 24 17:28:16 UTC 2025


#61996: Slug Conflict When a Published and Draft Page Share post_name
-------------------------------------------------+-------------------------
 Reporter:  brookedot                            |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Posts, Post Types                    |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  needs-patch good-first-bug has-      |     Focuses:
  test-info                                      |
-------------------------------------------------+-------------------------
Changes (by SirLouen):

 * keywords:   => needs-patch good-first-bug has-test-info
 * milestone:  Awaiting Review => Future Release


Comment:

 == Reproduction Report
 === Description
 ✅ This report validates that the issue can be reproduced.

 === Environment
 - WordPress: 6.9-alpha-60093-src
 - PHP: 8.2.29
 - Server: nginx/1.29.1
 - Database: mysqli (Server: 8.4.6 / Client: mysqlnd 8.2.29)
 - Browser: Chrome 139.0.0.0
 - OS: Windows 10/11
 - Theme: Twenty Twenty-Five 1.3
 - MU Plugins: None activated
 - Plugins:
   * Test Reports 1.2.0

 === Test Instructions
 - Used the ones  provided by the OP.
 - 🐞 Both child pages are linked as the same page following such
 procedure.

 === Actual Results
 1.  ✅ Error condition occurs (reproduced).

 === Additional Notes

 - I'm not going to add a video because the one provided in the OP works as
 expected. I did a little twist to the instructions as follows with the
 same result:
 1. Create the Placeholder > First Parent > First Child pages
 2. Create the Second Parent > Second Child page
 3. Set to draft First Parent and Child Pages
 4. Set First parent's parent to Main instead of Placeholder
 5. We can see that both Second And First Child page point to the First
 Child Page

 - It seems that the problem comes the moment we set the First Parent to
 root, leaving the link to Placeholder. After this, both posts share the
 same level hierarchy and the same `post_name` which causes a collision.
 Same happens for the First Parent and Second parent as they also share the
 same `post_name`. When changing the hierarchy, the system is not checking
 for collisions in `post_name` hence adding the corresponding `-2`, `-3`
 like when we create a new post with the exact same slug.

 - I have not digged deeply into the problem, but I have the suspicion that
 the problem is in `wp_unique_post_slug` function
 [https://github.com/wordpress/wordpress-
 develop/blob/a29146273253fb332113ed68e4ce8d767018ce2c/src/wp-
 includes/post.php#L5556-L5570 and could be somewhere around these lines].

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


More information about the wp-trac mailing list