Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: delete_category

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
52           die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one"), $cat_name));
53
54      if ( $user_level < 3 )
55           die (__('Cheatin&#8217; uh?'));
56
57      $wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'");
58      $wpdb->query("UPDATE $wpdb->categories SET category_parent = '$cat_parent' WHERE category_parent = '$cat_ID'");
59      // TODO: Only set categories to general if they're not in another category already
60      $wpdb->query("UPDATE $wpdb->post2cat SET category_id='1' WHERE category_id='$cat_ID'");
61      do_action('delete_category', $cat_ID);
62
63      header('Location: categories.php?message=2');
64
65 break;
66
67 case 'edit':
68
69     require_once ('admin-header.php');
70     $cat_ID = (int) $_GET['cat_ID'];