Changeset 15963
- Timestamp:
- 10/26/2010 01:16:08 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r15956 r15963 360 360 else 361 361 die('0'); 362 break;363 case 'delete-link-cat' :364 check_ajax_referer( "delete-link-category_$id" );365 if ( !current_user_can( 'manage_categories' ) )366 die('-1');367 368 $cat = get_term( $id, 'link_category' );369 if ( !$cat || is_wp_error( $cat ) )370 die('1');371 372 $cat_name = get_term_field('name', $id, 'link_category');373 374 $default = get_option('default_link_category');375 376 // Don't delete the default cats.377 if ( $id == $default ) {378 $x = new WP_AJAX_Response( array(379 'what' => 'link-cat',380 'id' => $id,381 'data' => new WP_Error( 'default-link-cat', sprintf(__("Can’t delete the <strong>%s</strong> category: this is the default one"), $cat_name) )382 ) );383 $x->send();384 }385 386 $r = wp_delete_term($id, 'link_category', array('default' => $default));387 if ( !$r )388 die('0');389 if ( is_wp_error($r) ) {390 $x = new WP_AJAX_Response( array(391 'what' => 'link-cat',392 'id' => $id,393 'data' => $r394 ) );395 $x->send();396 }397 die('1');398 362 break; 399 363 case 'delete-link' :
Note: See TracChangeset
for help on using the changeset viewer.