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:
parent
506192e771
commit
cdcfa08686
|
@ -242,8 +242,10 @@ case 'delete-link-cat' :
|
||||||
|
|
||||||
$cat_name = get_term_field('name', $id, 'link_category');
|
$cat_name = get_term_field('name', $id, 'link_category');
|
||||||
|
|
||||||
|
$default = get_option('default_link_category');
|
||||||
|
|
||||||
// Don't delete the default cats.
|
// Don't delete the default cats.
|
||||||
if ( $id == get_option('default_link_category') ) {
|
if ( $id == $default ) {
|
||||||
$x = new WP_AJAX_Response( array(
|
$x = new WP_AJAX_Response( array(
|
||||||
'what' => 'link-cat',
|
'what' => 'link-cat',
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
|
@ -252,7 +254,7 @@ case 'delete-link-cat' :
|
||||||
$x->send();
|
$x->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = wp_delete_term($id, 'link_category');
|
$r = wp_delete_term($id, 'link_category', array('default' => $default));
|
||||||
if ( !$r )
|
if ( !$r )
|
||||||
die('0');
|
die('0');
|
||||||
if ( is_wp_error($r) ) {
|
if ( is_wp_error($r) ) {
|
||||||
|
|
Loading…
Reference in New Issue