diff --git wp-includes/post.php wp-includes/post.php
index 1854459..d115385 100644
|
|
function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_p |
3033 | 3033 | if ( 'attachment' == $post_type ) { |
3034 | 3034 | // Attachment slugs must be unique across all types. |
3035 | 3035 | $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1"; |
3036 | | $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID ) ); |
| 3036 | $post_name_check = in_array( $slug, $feeds ) |
| 3037 | || apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug ) |
| 3038 | || $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID ) ); |
3037 | 3039 | |
3038 | | if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug ) ) { |
| 3040 | if ( $post_name_check ) { |
3039 | 3041 | $suffix = 2; |
3040 | 3042 | do { |
3041 | 3043 | $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; |
… |
… |
function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_p |
3050 | 3052 | // Page slugs must be unique within their own trees. Pages are in a separate |
3051 | 3053 | // namespace than posts so page slugs are allowed to overlap post slugs. |
3052 | 3054 | $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"; |
3053 | | $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID, $post_parent ) ); |
| 3055 | $post_name_check = in_array( $slug, $feeds ) |
| 3056 | || preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug ) |
| 3057 | || apply_filters( 'wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent ) |
| 3058 | || $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID, $post_parent ) ); |
3054 | 3059 | |
3055 | | if ( $post_name_check || in_array( $slug, $feeds ) || preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug ) || apply_filters( 'wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent ) ) { |
| 3060 | if ( $post_name_check ) { |
3056 | 3061 | $suffix = 2; |
3057 | 3062 | do { |
3058 | 3063 | $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; |
… |
… |
function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_p |
3064 | 3069 | } else { |
3065 | 3070 | // Post slugs must be unique across all posts. |
3066 | 3071 | $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1"; |
3067 | | $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) ); |
| 3072 | $post_type_obj = get_post_type_object( $post_type ); |
3068 | 3073 | |
3069 | | if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ) ) { |
| 3074 | $post_name_check = in_array( $slug, $feeds ) |
| 3075 | || ( $post_type_obj->has_archive && $wp_rewrite->pagination_base == $slug ) |
| 3076 | || apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ) |
| 3077 | || $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) ); |
| 3078 | |
| 3079 | if ( $post_name_check ) { |
3070 | 3080 | $suffix = 2; |
3071 | 3081 | do { |
3072 | 3082 | $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; |