Make WordPress Core

Ticket #2609: 2609.diff

File 2609.diff, 760 bytes (added by westi, 19 years ago)

Patch to ensure we don't attempt to delete the default cats

  • wp-admin/categories.php

     
    4444        $cat_ID = (int) $_GET['cat_ID'];
    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
     51    if ( $cat_ID == get_option('default_link_category') )
     52                die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one for bookmarks"), $cat_name));
     53
    5054        wp_delete_category($cat_ID);
    5155
    5256        header('Location: categories.php?message=2');