Reassign links to default cat when deleting link cats via ajax. fixes #9869
git-svn-id: http://svn.automattic.com/wordpress/trunk@11401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
40db336ea7
commit
d36f0721c8
|
@ -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