Ticket #13459: 13459.patch
| File 13459.patch, 1.2 KB (added by , 13 years ago) |
|---|
-
wp-includes/post.php
3131 3131 // Post slugs must be unique across all posts. 3132 3132 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1"; 3133 3133 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) ); 3134 if ( ! $post_name_check && '/%postname%/' == $wp_rewrite->permalink_structure ) 3135 $post_name_check = get_page_by_path( $slug ); 3134 3136 3135 3137 if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ) ) { 3136 3138 $suffix = 2; 3137 3139 do { 3138 3140 $alt_post_name = substr( $slug, 0, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; 3139 3141 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID ) ); 3142 if ( ! $post_name_check && '/%postname%/' == $wp_rewrite->permalink_structure ) 3143 $post_name_check = get_page_by_path( $alt_post_name ); 3140 3144 $suffix++; 3141 3145 } while ( $post_name_check ); 3142 3146 $slug = $alt_post_name;