wp_ajax_delete_tag() – Ajax handler for deleting a tag.

You appear to be a bot. Output may be restricted

Description

Ajax handler for deleting a tag.

Usage

wp_ajax_delete_tag();

Parameters

Returns

void

Source

File name: wordpress/wp-admin/includes/ajax-actions.php
Lines:

1 to 21 of 21
function wp_ajax_delete_tag() {
  $tag_id = (int) $_POST['tag_ID'];
  check_ajax_referer( "delete-tag_$tag_id" );

  if ( ! current_user_can( 'delete_term', $tag_id ) ) {
    wp_die( -1 );
  }

  $taxonomy = ! empty( $_POST['taxonomy'] ) ? $_POST['taxonomy'] : 'post_tag';
  $tag      = get_term( $tag_id, $taxonomy );

  if ( ! $tag || is_wp_error( $tag ) ) {
    wp_die( 1 );
  }

  if ( wp_delete_term( $tag_id, $taxonomy ) ) {
    wp_die( 1 );
  } else {
    wp_die( 0 );
  }
}
 

 View on GitHub View on Trac