break;
case 'delete':
+ if ( !isset( $_GET['cat_ID'] ) ) {
+ wp_redirect('categories.php');
+ exit;
+ }
+
$cat_ID = (int) $_GET['cat_ID'];
check_admin_referer('delete-category_' . $cat_ID);
if ( !current_user_can('manage_categories') )
wp_die(__('Cheatin’ uh?'));
- $cat_name = get_cat_name($cat_ID);
-
// Don't delete the default cats.
if ( $cat_ID == get_option('default_category') )
- wp_die(sprintf(__("Can’t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
+ wp_die( sprintf( __("Can’t delete the <strong>%s</strong> category: this is the default one"), get_cat_name($cat_ID) ) );
wp_delete_category($cat_ID);
if ( !current_user_can('manage_categories') )
wp_die( __('You are not allowed to delete categories.') );
- foreach ( (array) $_GET['delete'] as $cat_ID ) {
- $cat_name = get_cat_name($cat_ID);
+ $cats = (array) $_GET['delete'];
+ $default_cat = get_option('default_category');
+ foreach ( $cats as $cat_ID ) {
+ $cat_ID = (int) $cat_ID;
- // Don't delete the default cats.
- if ( $cat_ID == get_option('default_category') )
- wp_die(sprintf(__("Can’t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
+ // Don't delete the default cat.
+ if ( $cat_ID == $default_cat )
+ wp_die( sprintf( __("Can’t delete the <strong>%s</strong> category: this is the default one"), get_cat_name($cat_ID) ) );
wp_delete_category($cat_ID);
}
wp_safe_redirect( wp_get_referer() );
- exit();
+ exit;
break;
case 'edit':
if ( empty($pagenum) )
$pagenum = 1;
-$cats_per_page = get_user_option('categories_per_page');
-if ( empty($cats_per_page) )
+$cats_per_page = (int) get_user_option( 'categories_per_page', 0, false );
+if ( empty( $cats_per_page ) || $cats_per_page < 1 )
$cats_per_page = 20;
-$cats_per_page = apply_filters('edit_categories_per_page', $cats_per_page);
+$cats_per_page = apply_filters( 'edit_categories_per_page', $cats_per_page );
if ( !empty($_GET['s']) )
$num_cats = count(get_categories(array('hide_empty' => 0, 'search' => $_GET['s'])));
<div class="form-field">
<label for="category_description"><?php _e('Description') ?></label>
<textarea name="category_description" id="category_description" rows="5" cols="40"></textarea>
- <p><?php _e('The description is not prominent by default, however some themes may show it.'); ?></p>
+ <p><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p>
</div>
<p class="submit"><input type="submit" class="button" name="submit" value="<?php esc_attr_e('Add Category'); ?>" /></p>