Ticket #11863: 11863-1.patch
File 11863-1.patch, 5.8 KB (added by , 9 years ago) |
---|
-
wp-includes/post.php
2859 2859 } elseif ( in_array( $post_type, $hierarchical_post_types ) ) { 2860 2860 // Page slugs must be unique within their own trees. Pages are in a separate 2861 2861 // namespace than posts so page slugs are allowed to overlap post slugs. 2862 $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";2862 $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"; 2863 2863 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID, $post_parent ) ); 2864 2864 2865 2865 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 ) ) { … … 2873 2873 } 2874 2874 } else { 2875 2875 // Post slugs must be unique across all posts. 2876 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1";2876 $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"; 2877 2877 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) ); 2878 2878 2879 2879 if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ) ) { -
wp-admin/includes/post.php
1114 1114 } 1115 1115 } 1116 1116 1117 // Permalink conflict error messages. 1118 if ( $new_slug && $new_slug != $post_name_abridged ) { 1119 echo '<div id="message" class="error"><p>'; 1120 $conflicting_post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE post_name = %s;",$new_slug)); 1121 if ( $conflicting_post->post_status == 'trash' ) { 1122 _e('There was a permalink conflict with the post "' . $post->post_title . '" in the trash. <a href="edit.php?post_status=trash&post_type=' . $post->post_type . '">View Trash</a>'); 1123 } else { 1124 $conflicting_post_edit_link_url = get_edit_post_link($conflicting_post->ID); 1125 $post_type_obj = get_post_type_object( $post->post_type ); 1126 $conflicting_post_edit_link_html = '<a class="post-edit-link" href="' . $conflicting_post_edit_link_url . '" title="' . esc_attr( $post_type_obj->labels->edit_item ) . '">' . $conflicting_post->post_title . '</a>'; 1127 if ( !empty($conflicting_post) ) 1128 _e('There was a permalink conflict with the post ' . $conflicting_post_edit_link_html . ', a unique numerical string has been appended to the permalink.'); 1129 } 1130 echo '</p></div>'; 1131 } 1132 1117 1133 $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>'; 1118 1134 $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink); 1119 1135 $view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink); -
wp-admin/post.php
223 223 if ( ! wp_untrash_post($post_id) ) 224 224 wp_die( __('Error in restoring from Trash.') ); 225 225 226 $sendback = add_query_arg('ids', $post_id, $sendback); 227 226 228 wp_redirect( add_query_arg('untrashed', 1, $sendback) ); 227 229 exit(); 228 230 break; -
wp-admin/edit.php
97 97 wp_die( __('Error in restoring from Trash.') ); 98 98 99 99 $untrashed++; 100 $untrashed_posts[] = $post_id; 100 101 } 101 $sendback = add_query_arg('untrashed', $untrashed, $sendback); 102 $sendback = add_query_arg( 'ids', implode( '+', $untrashed_posts), $sendback ); 103 $sendback = add_query_arg( 'untrashed', $untrashed, $sendback ); 102 104 break; 103 105 case 'delete': 104 106 $deleted = 0; … … 251 253 if ( isset( $_REQUEST['untrashed'] ) && $untrashed = absint( $_REQUEST['untrashed'] ) ) { 252 254 $messages[] = sprintf( _n( 'Item restored from the Trash.', '%s items restored from the Trash.', $untrashed ), number_format_i18n( $untrashed ) ); 253 255 } 254 255 256 if ( $messages ) 256 257 echo join( ' ', $messages ); 257 258 unset( $messages ); … … 259 260 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed' ), $_SERVER['REQUEST_URI'] ); 260 261 ?> 261 262 </p></div> 263 <?php 264 // Post permalink collision errors 265 if ( isset( $_REQUEST['untrashed'] ) && $untrashed = absint( $_REQUEST['untrashed'] ) && isset($_REQUEST['ids']) && $_REQUEST['ids'] ) { 266 $posts_restored = explode( ' ', $_REQUEST['ids'] ); 267 foreach ( $posts_restored as $id ) { 268 $post = get_post($id); 269 if ( $post->post_name != sanitize_title($post->post_title) ) {?> 270 <div id="message" class="error"><p> 271 <?php printf( __( 'While restoring from trash, the post %s\'s slug was set to %s because of a permalink collision.'), $post->post_title, $post->post_name ); 272 ?></p> 273 </div><?php 274 } 275 } 276 } 277 ?> 262 278 <?php } ?> 263 279 264 280 <?php $wp_list_table->views(); ?> -
wp-admin/css/wp-admin.dev.css
2932 2932 } 2933 2933 2934 2934 #edit-slug-box { 2935 height: 1em;2936 2935 margin-top: 8px; 2937 2936 padding: 0 10px; 2938 2937 }