Wordpress allow to set default category in "Options MenĂ¹". In "Manage Categories" menĂ¹ it is written "Deleting a category does not delete posts from that category, it will just set them back to the default category <my_default_category>" but if I delete a category, posts of that category are set on category with ID = 1, Uncategorized Category. This category may not be the default cateroty.
If I can afford, I think that files involved in are:
1- /wordpress/wp-admin/admin-db.php
2- /wordpress/wp-admin/categories.php
I have fixed this problem in this way (lines with "<" are removed, with ">" are added, with "--" are unmodified) :
--- File categories.php --- [around line 47]
< if (1 == $cat_ID)
> if (get_cat_ID(get_catname(get_option('default_category'))) == $cat_ID)
-- die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one"), $cat_name));
--- File admin-db.php --- [around line 169 - in wp_delete_category function]
> $cat_def = get_cat_ID(get_catname(get_option('default_category')));
< $wpdb->query("UPDATE $wpdb->post2cat SET category_id='1' WHERE category_id='$cat_ID'");
> $wpdb->query("UPDATE $wpdb->post2cat SET category_id='$cat_def' WHERE category_id='$cat_ID'");
MY PLATFORM:
- O.S.: Debian Testing GNU/Linux - Kernel 2.6.15.4
- PHP v. 4;
- MySql? v. 4.1;
- Web Sever: Apache v. 1.3;