Reassign links to default cat when deleting link cats via ajax. fixes #9869

git-svn-id: https://develop.svn.wordpress.org/trunk@11401 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2009-05-19 18:08:15 +00:00
parent 506192e771
commit cdcfa08686
1 changed files with 4 additions and 2 deletions

View File

@ -242,8 +242,10 @@ case 'delete-link-cat' :
$cat_name = get_term_field('name', $id, 'link_category');
$default = get_option('default_link_category');
// Don't delete the default cats.
if ( $id == get_option('default_link_category') ) {
if ( $id == $default ) {
$x = new WP_AJAX_Response( array(
'what' => 'link-cat',
'id' => $id,
@ -252,7 +254,7 @@ case 'delete-link-cat' :
$x->send();
}
$r = wp_delete_term($id, 'link_category');
$r = wp_delete_term($id, 'link_category', array('default' => $default));
if ( !$r )
die('0');
if ( is_wp_error($r) ) {