WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_REST_Terms_Controller::delete_item() WP 4.7.0

Deletes a single term from a taxonomy.

Это метод класса: WP_REST_Terms_Controller

Хуки из метода
Возвращает

WP_REST_Response/WP_Error. Response object on success, or WP_Error object on failure.

Использование

$WP_REST_Terms_Controller = new WP_REST_Terms_Controller();
$var = $WP_REST_Terms_Controller->delete_item( $request );
$request(WP_REST_Request) (обязательный)
Full details about the request.

Код WP REST Terms Controller::delete item: wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php WP 5.2

<?php
public function delete_item( $request ) {
	$term = $this->get_term( $request['id'] );
	if ( is_wp_error( $term ) ) {
		return $term;
	}

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

	// We don't support trashing for terms.
	if ( ! $force ) {
		/* translators: %s: force=true */
		return new WP_Error( 'rest_trash_not_supported', sprintf( __( "Terms do not support trashing. Set '%s' to delete." ), 'force=true' ), array( 'status' => 501 ) );
	}

	$request->set_param( 'context', 'view' );

	$previous = $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 term cannot be deleted.' ), array( 'status' => 500 ) );
	}

	$response = new WP_REST_Response();
	$response->set_data(
		array(
			'deleted'  => true,
			'previous' => $previous->get_data(),
		)
	);

	/**
	 * Fires after a single term is deleted via the REST API.
	 *
	 * The dynamic portion of the hook name, `$this->taxonomy`, refers to the taxonomy slug.
	 *
	 * @since 4.7.0
	 *
	 * @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;
}