mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Deleting a category moves any subcats up the hierarchy.
git-svn-id: http://svn.automattic.com/wordpress/trunk@862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4ce864c6bc
commit
bca08d2d24
@ -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 <strong>$cat_name</strong> 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');
|
||||
|
Loading…
Reference in New Issue
Block a user