WordPress.org

Make WordPress Core

Ticket #5684: tagbulk.diff

File tagbulk.diff, 1.4 KB (added by jhodgdon, 14 years ago)

Add bulk delete to tag management page

  • opt/www/eclipsework/WPDev/wp-admin/edit-tags.php

     
    3838
    3939break;
    4040
     41case 'bulk-delete':
     42        check_admin_referer('bulk-tags');
     43
     44        if ( !current_user_can('manage_categories') )
     45                wp_die(__('Cheatin’ uh?'));
     46
     47        $tags = $_POST['delete_tags'];
     48        foreach( $tags as $tag_ID ) {
     49          wp_delete_term( $tag_ID, 'post_tag');
     50        }
     51
     52        wp_redirect('edit-tags.php?message=6');
     53        exit;
     54
     55break;
     56
    4157case 'edit':
    4258
    4359        require_once ('admin-header.php');
     
    7692$messages[3] = __('Tag updated.');
    7793$messages[4] = __('Tag not added.');
    7894$messages[5] = __('Tag not updated.');
     95$messages[6] = __('Tags deleted.');
    7996?>
    8097
    8198<?php if (isset($_GET['message'])) : ?>
     
    100117
    101118<form name="deletetags" id="deletetags" action="" method="post">
    102119<?php wp_nonce_field('bulk-tags'); ?>
     120<input type="hidden" name="action" value="bulk-delete" />
    103121<table class="widefat">
    104122        <thead>
    105123        <tr>
     
    122140?>
    123141        </tbody>
    124142</table>
     143<p class="submit"><input type="submit" class="button" name="deletetags" id="deletetags" value="<?php _e('Delete Checked Tags &raquo;') ?>" onclick="return confirm('<?php echo js_escape(__("You are about to delete these tags permanently.\n'Cancel' to stop, 'OK' to delete.")); ?>')" /></p>
    125144</form>
    126145<?php
    127146