RCS file: /cvsroot/cafelog/wordpress/wp-admin/categories.php,v
retrieving revision 1.36
diff -u -3 -r1.36 categories.php
|
|
|
69 | 69 | $cat_name = get_catname($cat_ID); |
70 | 70 | $category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$cat_ID'"); |
71 | 71 | $cat_parent = $category->category_parent; |
| 72 | $cat_default = get_settings('default_category'); |
| 73 | if ($cat_default == $cat_ID) $cat_default = 1; // Make sure default isn't being deleted |
72 | 74 | |
73 | 75 | if (1 == $cat_ID) |
74 | 76 | die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one"), $cat_name)); |
… |
… |
|
78 | 80 | |
79 | 81 | $wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'"); |
80 | 82 | $wpdb->query("UPDATE $wpdb->categories SET category_parent = '$cat_parent' WHERE category_parent = '$cat_ID'"); |
81 | | $wpdb->query("UPDATE $wpdb->post2cat SET category_id='1' WHERE category_id='$cat_ID'"); |
| 83 | $wpdb->query("UPDATE $wpdb->post2cat SET category_id='$cat_default' WHERE category_id='$cat_ID'"); |
82 | 84 | |
83 | 85 | header('Location: categories.php?message=2'); |
84 | 86 | |