[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 Feb 2 10:29:27 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        |   Keywords:  needs-patch
  Focuses:                |
--------------------------+-----------------------------
 Step-by-step reproduction instructions

 1. create custom post type. and set `'show_in_rest' => true`

 {{{#!php
 <?php
 function custom_init() {
         $args = array(
                 'public' => true,
                 'label'  => 'Books',
                 'show_in_rest' => true,
         );
         register_post_type( 'book', $args );
 }
 add_action( 'init', 'custom_init' );
 }}}

 2. Publish new post of the post type.
 3. Create draft post of the post type with same slug.
 4. Go to the published post. but show draft post. if logged out, 404.


 Using the block editor, a page can also create drafts with the same slug,
 which causes the same problem.

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


More information about the wp-trac mailing list