Bulk tag delete

git-svn-id: http://svn.automattic.com/wordpress/trunk@6848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-02-14 09:26:40 +00:00
parent 088cd992fd
commit 1c0cf5a6b6
1 changed files with 17 additions and 15 deletions

View File

@ -6,6 +6,9 @@ $parent_file = 'edit.php';
wp_reset_vars(array('action', 'tag')); wp_reset_vars(array('action', 'tag'));
if ( isset($_GET['deleteit']) && isset($_GET['delete_tags']) )
$action = 'bulk-delete';
switch($action) { switch($action) {
case 'addtag': case 'addtag':
@ -44,8 +47,8 @@ case 'bulk-delete':
if ( !current_user_can('manage_categories') ) if ( !current_user_can('manage_categories') )
wp_die(__('Cheatin’ uh?')); wp_die(__('Cheatin’ uh?'));
$tags = $_POST['delete_tags']; $tags = $_GET['delete_tags'];
foreach( $tags as $tag_ID ) { foreach( (array) $tags as $tag_ID ) {
wp_delete_term( $tag_ID, 'post_tag'); wp_delete_term( $tag_ID, 'post_tag');
} }
@ -136,22 +139,20 @@ if ( $page_links )
?> ?>
<div style="float: left"> <div style="float: left">
<input type="button" value="<?php _e('Delete'); ?>" name="deleteit" /> <input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" />
</div>
<br style="clear:both;" />
</div>
</form>
<br style="clear:both;" />
<form name="deletetags" id="deletetags" action="" method="post">
<?php wp_nonce_field('bulk-tags'); ?> <?php wp_nonce_field('bulk-tags'); ?>
</div>
<br style="clear:both;" />
</div>
<br style="clear:both;" />
<input type="hidden" name="action" value="bulk-delete" /> <input type="hidden" name="action" value="bulk-delete" />
<table class="widefat"> <table class="widefat">
<thead> <thead>
<tr> <tr>
<th scope="col" style="text-align: center"><input type="checkbox" onclick="checkAll(document.getElementById('deletetags'));" /></th> <th scope="col" style="text-align: center"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
<th scope="col"><?php _e('Name') ?></th> <th scope="col"><?php _e('Name') ?></th>
<th scope="col" width="90" style="text-align: center"><?php _e('Posts') ?></th> <th scope="col" width="90" style="text-align: center"><?php _e('Posts') ?></th>
</tr> </tr>
@ -165,9 +166,10 @@ $count = tag_rows( $pagenum, $tagsperpage, $searchterms );
?> ?>
</tbody> </tbody>
</table> </table>
<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>
</form> </form>
<br style="clear:both;" />
<div class="tablenav"> <div class="tablenav">
<?php <?php