Make WordPress Core

Changeset 4032


Ignore:
Timestamp:
07/23/2006 06:27:00 PM (18 years ago)
Author:
ryan
Message:

Default cat deletion fix from westi. fixes #2789

Location:
branches/2.0/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/wp-admin/admin-db.php

    r3802 r4032  
    157157
    158158    // Don't delete the default cat.
    159     if (1 == $cat_ID)
     159    if ($cat_ID == get_option('default_category'))
    160160        return 0;
    161161
     
    171171
    172172    // TODO: Only set categories to general if they're not in another category already
    173     $wpdb->query("UPDATE $wpdb->post2cat SET category_id='1' WHERE category_id='$cat_ID'");
     173    $default_cat = get_option('default_category');
     174    $wpdb->query("UPDATE $wpdb->post2cat SET category_id='$default_cat' WHERE category_id='$cat_ID'");
    174175
    175176    wp_cache_delete($cat_ID, 'category');
  • branches/2.0/wp-admin/categories.php

    r3937 r4032  
    4545    $cat_name = get_catname($cat_ID);
    4646
    47     if ( 1 == $cat_ID )
     47    // Don't delete the default cats.
     48    if ( $cat_ID == get_option('default_category') )
    4849        die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one"), $cat_name));
    4950
Note: See TracChangeset for help on using the changeset viewer.