Fix errors when bulk actions executed on empty list, props nacin, see #11184

git-svn-id: https://develop.svn.wordpress.org/trunk@12317 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2009-12-03 01:43:49 +00:00
parent 65e6d5fb10
commit 07f2fd2e4b
8 changed files with 40 additions and 23 deletions
+5 -4
View File
@@ -18,13 +18,14 @@ if ( isset($_GET['action']) && isset($_GET['delete']) ) {
wp_die(__('Cheatin’ uh?'));
if ( 'delete' == $doaction ) {
foreach( (array) $_GET['delete'] as $cat_ID ) {
$cat_name = get_term_field('name', $cat_ID, 'link_category');
$default_cat_id = get_option('default_link_category');
$cats = (array) $_GET['delete'];
$default_cat_id = get_option('default_link_category');
foreach( $cats as $cat_ID ) {
$cat_ID = (int) $cat_ID;
// Don't delete the default cats.
if ( $cat_ID == $default_cat_id )
wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
wp_die( sprintf( __("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), get_term_field('name', $cat_ID, 'link_category') ) );
wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id));
}