WordPress.org

Make WordPress Core

Ticket #11184: 11184-cats-tags-2.patch

File 11184-cats-tags-2.patch, 2.2 KB (added by nacin, 4 years ago)

New messages for cat/tag/tax bulk editing

  • categories.php

     
    3434break; 
    3535 
    3636case 'delete': 
     37        if ( !isset( $_GET['cat_ID'] ) ) 
     38                wp_redirect('categories.php?message=7'); 
     39 
    3740        $cat_ID = (int) $_GET['cat_ID']; 
    3841        check_admin_referer('delete-category_' .  $cat_ID); 
    3942 
     
    5962        if ( !current_user_can('manage_categories') ) 
    6063                wp_die( __('You are not allowed to delete categories.') ); 
    6164 
    62         foreach ( (array) $_GET['delete'] as $cat_ID ) { 
     65        $cats = $_GET['delete']; 
     66        foreach ( (array) $cats as $cat_ID ) { 
    6367                $cat_name = get_cat_name($cat_ID); 
    6468 
    6569                // Don't delete the default cats. 
     
    6973                wp_delete_category($cat_ID); 
    7074        } 
    7175 
    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() ) ); 
    7380        exit(); 
    7481 
    7582break; 
     
    125132$messages[3] = __('Category updated.'); 
    126133$messages[4] = __('Category not added.'); 
    127134$messages[5] = __('Category not updated.'); 
     135$messages[6] = __('Categories deleted.'); 
     136$messages[7] = __('No categories selected.'); 
    128137?> 
    129138 
    130139<div class="wrap nosubsub"> 
  • edit-tags.php

     
    4444break; 
    4545 
    4646case 'delete': 
     47        if ( !isset( $_GET['tag_ID'] ) ) 
     48                wp_redirect('edit-tags.php?message=7'); 
     49 
    4750        $tag_ID = (int) $_GET['tag_ID']; 
    4851        check_admin_referer('delete-tag_' .  $tag_ID); 
    4952 
     
    8184                        $location = $referer; 
    8285        } 
    8386 
    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); 
    8591        wp_redirect($location); 
    8692        exit; 
    8793 
     
    142148$messages[3] = __('Tag updated.'); 
    143149$messages[4] = __('Tag not added.'); 
    144150$messages[5] = __('Tag not updated.'); 
    145 $messages[6] = __('Tags deleted.'); ?> 
     151$messages[6] = __('Tags deleted.'); 
     152$messages[7] = __('No tags selected.'); ?> 
    146153 
    147154<div class="wrap nosubsub"> 
    148155<?php screen_icon(); ?>