Ticket #11863: post.patch
File post.patch, 1.5 KB (added by , 15 years ago) |
---|
-
post.php
2430 2430 } elseif ( in_array( $post_type, $hierarchical_post_types ) ) { 2431 2431 // Page slugs must be unique within their own trees. Pages are in a separate 2432 2432 // namespace than posts so page slugs are allowed to overlap post slugs. 2433 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode( "', '", esc_sql( $hierarchical_post_types ) ) . "' ) AND ID != %d AND post_parent = %d LIMIT 1";2433 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode( "', '", esc_sql( $hierarchical_post_types ) ) . "' ) AND ID != %d AND post_parent = %d AND post_status <> 'trash' LIMIT 1"; 2434 2434 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID, $post_parent ) ); 2435 2435 2436 2436 if ( $post_name_check || in_array( $slug, $feeds ) || preg_match( '@^(page)?\d+$@', $slug ) ) { … … 2444 2444 } 2445 2445 } else { 2446 2446 // Post slugs must be unique across all posts. 2447 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1";2447 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d AND post_status <> 'trash' LIMIT 1"; 2448 2448 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) ); 2449 2449 2450 2450 if ( $post_name_check || in_array( $slug, $feeds ) ) {