Ticket #11184: 11184-cats-tags-2.patch
| File 11184-cats-tags-2.patch, 2.2 KB (added by nacin, 3 years ago) |
|---|
-
categories.php
34 34 break; 35 35 36 36 case 'delete': 37 if ( !isset( $_GET['cat_ID'] ) ) 38 wp_redirect('categories.php?message=7'); 39 37 40 $cat_ID = (int) $_GET['cat_ID']; 38 41 check_admin_referer('delete-category_' . $cat_ID); 39 42 … … 59 62 if ( !current_user_can('manage_categories') ) 60 63 wp_die( __('You are not allowed to delete categories.') ); 61 64 62 foreach ( (array) $_GET['delete'] as $cat_ID ) { 65 $cats = $_GET['delete']; 66 foreach ( (array) $cats as $cat_ID ) { 63 67 $cat_name = get_cat_name($cat_ID); 64 68 65 69 // Don't delete the default cats. … … 69 73 wp_delete_category($cat_ID); 70 74 } 71 75 72 wp_safe_redirect( wp_get_referer() ); 76 if ( count( (array) $cats ) == 1 ) 77 wp_safe_redirect( add_query_arg( 'message', 2, wp_get_referer() ) ); 78 else 79 wp_safe_redirect( add_query_arg( 'message', 6, wp_get_referer() ) ); 73 80 exit(); 74 81 75 82 break; … … 125 132 $messages[3] = __('Category updated.'); 126 133 $messages[4] = __('Category not added.'); 127 134 $messages[5] = __('Category not updated.'); 135 $messages[6] = __('Categories deleted.'); 136 $messages[7] = __('No categories selected.'); 128 137 ?> 129 138 130 139 <div class="wrap nosubsub"> -
edit-tags.php
44 44 break; 45 45 46 46 case 'delete': 47 if ( !isset( $_GET['tag_ID'] ) ) 48 wp_redirect('edit-tags.php?message=7'); 49 47 50 $tag_ID = (int) $_GET['tag_ID']; 48 51 check_admin_referer('delete-tag_' . $tag_ID); 49 52 … … 81 84 $location = $referer; 82 85 } 83 86 84 $location = add_query_arg('message', 6, $location); 87 if ( count( (array) $tags ) == 1 ) 88 $location = add_query_arg('message', 2, $location); 89 else 90 $location = add_query_arg('message', 6, $location); 85 91 wp_redirect($location); 86 92 exit; 87 93 … … 142 148 $messages[3] = __('Tag updated.'); 143 149 $messages[4] = __('Tag not added.'); 144 150 $messages[5] = __('Tag not updated.'); 145 $messages[6] = __('Tags deleted.'); ?> 151 $messages[6] = __('Tags deleted.'); 152 $messages[7] = __('No tags selected.'); ?> 146 153 147 154 <div class="wrap nosubsub"> 148 155 <?php screen_icon(); ?>
