[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
Tue Jun 15 18:00:15 UTC 2021


#52422: Create a draft with the same slug as an existing post, the existing post
will be 404.
--------------------------------------+------------------------------
 Reporter:  Toro_Unit                 |       Owner:  (none)
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  General                   |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+------------------------------

Comment (by Toro_Unit):

 get_page_by_path is used in WP_Query.

 * Draft page ( id: 1, slug: foo, status: draft )
 * Published page ( id: 2, slug: foo, status: publish )

 If the above two posts exist, get_page_by_path will get the draft page.
 That post will be set to queried_object.

 https://github.com/WordPress/wordpress-develop/blob/5.7.2/src/wp-includes
 /class-wp-query.php#L1001

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


More information about the wp-trac mailing list