Ticket #13459: 13459.2.patch
| File 13459.2.patch, 1.1 KB (added by , 13 years ago) |
|---|
-
post.php
3072 3072 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1"; 3073 3073 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) ); 3074 3074 3075 if ( ! $post_name_check && '/%postname%/' == $wp_rewrite->permalink_structure ) 3076 $post_name_check = get_page_by_path( $slug ); 3077 3075 3078 if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ) ) { 3076 3079 $suffix = 2; 3077 3080 do { 3078 3081 $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; 3079 3082 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID ) ); 3083 3084 if ( ! $post_name_check && '/%postname%/' == $wp_rewrite->permalink_structure ) 3085 $post_name_check = get_page_by_path( $alt_post_name ); 3086 3080 3087 $suffix++; 3081 3088 } while ( $post_name_check ); 3082 3089 $slug = $alt_post_name;