From c93a283eabccde86ec62b69e66005057fa870248 Mon Sep 17 00:00:00 2001 From: jverber Date: Tue, 10 Feb 2004 23:39:08 +0000 Subject: [PATCH] Deleting a category moves any subcats up the hierarchy. git-svn-id: https://develop.svn.wordpress.org/trunk@862 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/categories.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wp-admin/categories.php b/wp-admin/categories.php index 49ae994f56..bb28878895 100644 --- a/wp-admin/categories.php +++ b/wp-admin/categories.php @@ -63,6 +63,8 @@ case 'Delete': $cat_ID = intval($HTTP_GET_VARS["cat_ID"]); $cat_name = get_catname($cat_ID); $cat_name = addslashes($cat_name); + $category = $wpdb->get_row("SELECT * FROM $tablecategories WHERE cat_ID = " . $cat_ID); + $cat_parent = $category->category_parent; if (1 == $cat_ID) die("Can't delete the $cat_name category: this is the default one"); @@ -71,6 +73,7 @@ case 'Delete': die ('Cheatin’ uh?'); $wpdb->query("DELETE FROM $tablecategories WHERE cat_ID = $cat_ID"); + $wpdb->query("UPDATE $tablecategories SET category_parent=$cat_parent WHERE category_parent=$cat_ID"); $wpdb->query("UPDATE $tablepost2cat SET category_id='1' WHERE category_id='$cat_ID'"); header('Location: categories.php');