public function delete_item( $request ) {

		$force = isset( $request['force'] ) ? (bool) $request['force'] : false;

		// We don't support trashing for this resource type.
		if ( ! $force ) {
			return new WP_Error( 'rest_trash_not_supported', __( 'Resource does not support trashing.' ), array( 'status' => 501 ) );
		}

		$term = get_term( (int) $request['id'], $this->taxonomy );
		$request->set_param( 'context', 'view' );
		$response = $this->prepare_item_for_response( $term, $request );

		$retval = wp_delete_term( $term->term_id, $term->taxonomy );
		if ( ! $retval ) {
			return new WP_Error( 'rest_cannot_delete', __( 'The resource cannot be deleted.' ), array( 'status' => 500 ) );
		}

		/**
		 * Fires after a single term is deleted via the REST API.
		 *
		 * @param WP_Term          $term     The deleted term.
		 * @param WP_REST_Response $response The response data.
		 * @param WP_REST_Request  $request  The request sent to the API.
		 */
		do_action( "rest_delete_{$this->taxonomy}", $term, $response, $request );

		return $response;
	}
public function delete_item( $request ) {

		$force = isset( $request['force'] ) ? (bool) $request['force'] : false;

		// We don't support trashing for this resource type.
		if ( ! $force ) {
			return new WP_Error( 'rest_trash_not_supported', __( 'Resource does not support trashing.' ), array( 'status' => 501 ) );
		}

		$term = get_term( (int) $request['id'], $this->taxonomy );
		$request->set_param( 'context', 'view' );
		$response = $this->prepare_item_for_response( $term, $request );

		$retval = wp_delete_term( $term->term_id, $term->taxonomy );
		if ( ! $retval ) {
			return new WP_Error( 'rest_cannot_delete', __( 'The resource cannot be deleted.' ), array( 'status' => 500 ) );
		}

		/**
		 * Fires after a single term is deleted via the REST API.
		 *
		 * @param WP_Term          $term     The deleted term.
		 * @param WP_REST_Response $response The response data.
		 * @param WP_REST_Request  $request  The request sent to the API.
		 */
		do_action( "rest_delete_{$this->taxonomy}", $term, $response, $request );

		return $response;
	}
public function delete_item ( $ request ) { $ force = isset ( $ request [ 'force' ] ) ? ( bool ) $ request [ 'force' ] : false ; // We don't support trashing for this resource type. if ( ! $ force ) { return new WP_Error ( 'rest_trash_not_supported' , __ ( 'Resource does not support trashing.' ) , array ( 'status' => 501 ) ) ; } $ term = get_term ( ( int ) $ request [ 'id' ] , $ this -> taxonomy ) ; $ request -> set_param ( 'context' , 'view' ) ; $ response = $ this -> prepare_item_for_response ( $ term , $ request ) ; $ retval = wp_delete_term ( $ term -> term_id , $ term -> taxonomy ) ; if ( ! $ retval ) { return new WP_Error ( 'rest_cannot_delete' , __ ( 'The resource cannot be deleted.' ) , array ( 'status' => 500 ) ) ; } /**
		 * Fires after a single term is deleted via the REST API.
		 *
		 * @param WP_Term          $term     The deleted term.
		 * @param WP_REST_Response $response The response data.
		 * @param WP_REST_Request  $request  The request sent to the API.
		 */ do_action ( "rest_delete_{$this->taxonomy}" , $ term , $ response , $ request ) ; return $ response ; }
Deletes a single term from a taxonomy.

@param WP_REST_Request $request Full details about the request
@return WP_REST_Response|WP_Error
Deletes a single term from a taxonomy .