mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-11 14:22:26 +01:00
Remove dead 'delete-link-cat' ajax handler. See #12285
git-svn-id: http://svn.automattic.com/wordpress/trunk@15963 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
da54089621
commit
497335778b
@ -360,42 +360,6 @@ case 'delete-tag' :
|
|||||||
else
|
else
|
||||||
die('0');
|
die('0');
|
||||||
break;
|
break;
|
||||||
case 'delete-link-cat' :
|
|
||||||
check_ajax_referer( "delete-link-category_$id" );
|
|
||||||
if ( !current_user_can( 'manage_categories' ) )
|
|
||||||
die('-1');
|
|
||||||
|
|
||||||
$cat = get_term( $id, 'link_category' );
|
|
||||||
if ( !$cat || is_wp_error( $cat ) )
|
|
||||||
die('1');
|
|
||||||
|
|
||||||
$cat_name = get_term_field('name', $id, 'link_category');
|
|
||||||
|
|
||||||
$default = get_option('default_link_category');
|
|
||||||
|
|
||||||
// Don't delete the default cats.
|
|
||||||
if ( $id == $default ) {
|
|
||||||
$x = new WP_AJAX_Response( array(
|
|
||||||
'what' => 'link-cat',
|
|
||||||
'id' => $id,
|
|
||||||
'data' => new WP_Error( 'default-link-cat', sprintf(__("Can’t delete the <strong>%s</strong> category: this is the default one"), $cat_name) )
|
|
||||||
) );
|
|
||||||
$x->send();
|
|
||||||
}
|
|
||||||
|
|
||||||
$r = wp_delete_term($id, 'link_category', array('default' => $default));
|
|
||||||
if ( !$r )
|
|
||||||
die('0');
|
|
||||||
if ( is_wp_error($r) ) {
|
|
||||||
$x = new WP_AJAX_Response( array(
|
|
||||||
'what' => 'link-cat',
|
|
||||||
'id' => $id,
|
|
||||||
'data' => $r
|
|
||||||
) );
|
|
||||||
$x->send();
|
|
||||||
}
|
|
||||||
die('1');
|
|
||||||
break;
|
|
||||||
case 'delete-link' :
|
case 'delete-link' :
|
||||||
check_ajax_referer( "delete-bookmark_$id" );
|
check_ajax_referer( "delete-bookmark_$id" );
|
||||||
if ( !current_user_can( 'manage_links' ) )
|
if ( !current_user_can( 'manage_links' ) )
|
||||||
|
Loading…
Reference in New Issue
Block a user