Make WordPress Core

Ticket #17170: 17170.diff

File 17170.diff, 730 bytes (added by DrewAPicture, 10 years ago)
  • src/wp-includes/post.php

     
    38313831                }
    38323832        } else {
    38333833                // Post slugs must be unique across all posts.
    3834                 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1";
     3834                $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ( post_type = %s OR post_type = 'attachment' ) AND ID != %d LIMIT 1";
    38353835                $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) );
    38363836
    38373837                // Prevent new post slugs that could result in URLs that conflict with date archives.