Make WordPress Core

Ticket #7316: 7316.diff

File 7316.diff, 1.6 KB (added by scohoust, 18 years ago)

Passes the default link category id

  • wp-admin/edit-link-categories.php

     
    1010
    1111        foreach( (array) $_GET['delete'] as $cat_ID ) {
    1212                $cat_name = get_term_field('name', $cat_ID, 'link_category');
    13 
     13                $default_cat_id = get_option('default_link_category');
     14               
    1415                // Don't delete the default cats.
    15                 if ( $cat_ID == get_option('default_link_category') )
     16                if ( $cat_ID == $default_cat_id )
    1617                        wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
    1718
    18                 wp_delete_term($cat_ID, 'link_category');
     19                wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id));
    1920        }
    2021
    2122        $location = 'edit-link-categories.php';
  • wp-admin/link-category.php

     
    2828                wp_die(__('Cheatin&#8217; uh?'));
    2929
    3030        $cat_name = get_term_field('name', $cat_ID, 'link_category');
     31        $default_cat_id = get_option('default_link_category');
    3132
    3233        // Don't delete the default cats.
    33     if ( $cat_ID == get_option('default_link_category') )
     34    if ( $cat_ID == $default_cat_id )
    3435                wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
    3536
    36         wp_delete_term($cat_ID, 'link_category');
     37        wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id));
    3738
    3839        $location = 'edit-link-categories.php';
    3940        if ( $referer = wp_get_original_referer() ) {