Skip to content

Commit

Permalink
Fix assignment of links to the default category when a category is de…
Browse files Browse the repository at this point in the history
…leted. Props scohoust. fixes #7316 for 2.6

git-svn-id: http://svn.automattic.com/wordpress/branches/2.6@8389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
ryan committed Jul 21, 2008
1 parent 580cd63 commit 582c3ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions wp-admin/edit-link-categories.php
Expand Up @@ -10,12 +10,13 @@

foreach( (array) $_GET['delete'] as $cat_ID ) {
$cat_name = get_term_field('name', $cat_ID, 'link_category');

$default_cat_id = get_option('default_link_category');

// Don't delete the default cats.
if ( $cat_ID == get_option('default_link_category') )
if ( $cat_ID == $default_cat_id )
wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));

wp_delete_term($cat_ID, 'link_category');
wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id));
}

$location = 'edit-link-categories.php';
Expand Down
5 changes: 3 additions & 2 deletions wp-admin/link-category.php
Expand Up @@ -28,12 +28,13 @@
wp_die(__('Cheatin&#8217; uh?'));

$cat_name = get_term_field('name', $cat_ID, 'link_category');
$default_cat_id = get_option('default_link_category');

// Don't delete the default cats.
if ( $cat_ID == get_option('default_link_category') )
if ( $cat_ID == $default_cat_id )
wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));

wp_delete_term($cat_ID, 'link_category');
wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id));

$location = 'edit-link-categories.php';
if ( $referer = wp_get_original_referer() ) {
Expand Down

0 comments on commit 582c3ec

Please sign in to comment.