[wp-trac] [WordPress Trac] #2609: Set posts of deleted category on
the default category
WordPress Trac
wp-trac at lists.automattic.com
Thu Mar 30 16:29:55 GMT 2006
#2609: Set posts of deleted category on the default category
----------------------------+-----------------------------------------------
Id: 2609 | Status: new
Component: Administration | Modified: Thu Mar 30 16:29:55 2006
Severity: critical | Milestone:
Priority: normal | Version: 2.0.2
Owner: anonymous | Reporter: santana
----------------------------+-----------------------------------------------
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;
--
Ticket URL: <http://trac.wordpress.org/ticket/2609>
WordPress Trac <http://wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list