23 | | For one, the logic for `wp_unique_post_slug()` can be changed to explicitly ignore `auto-draft` posts when it is doing the lookup to see if a slug is already being used. This seems like a no-brainer: |
24 | | |
25 | | {{{#!diff |
26 | | --- src/wp-includes/post.php |
27 | | +++ src/wp-includes/post.php |
28 | | @@ -3673,7 +3673,7 @@ function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_p |
29 | | |
30 | | if ( 'attachment' == $post_type ) { |
31 | | // Attachment slugs must be unique across all types. |
32 | | - $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1"; |
33 | | + $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_status != 'auto-draft' post_name = %s AND ID != %d LIMIT 1"; |
34 | | $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID ) ); |
35 | | |
36 | | /** |
37 | | }}} |
| 23 | For one, the logic for `wp_unique_post_slug()` can be changed to explicitly ignore `auto-draft` posts when it is doing the lookup to see if a slug is already being used. This seems like a no-brainer: [attachment:38928.2.diff] |