Tribe__Events__REST__V1__Endpoints__Term_Single_Base::delete( WP_REST_Request $request )
Handles DELETE requests on the endpoint.
Contents
Parameters
- $request
-
(WP_REST_Request) (Required)
Return
(WP_Error|WP_REST_Response) An array containing the data of the trashed post on success or a WP_Error instance on failure.
Source
File: src/Tribe/REST/V1/Endpoints/Term_Single_Base.php
public function delete( WP_REST_Request $request ) {
/**
* Filters whether term deletion is supported in TEC REST API or not.
*
* @since 4.6
*
* @param bool $support_deletion
*/
$support_deletion = apply_filters( 'tribe_events_rest_term_allow_delete', true );
if ( $support_deletion ) {
$request['force'] = true;
}
$term_response = $this->terms_controller->delete_item( $request );
if ( is_wp_error( $term_response ) ) {
return $term_response;
}
$term_data = $term_response->get_data();
$data = $this->repository->prepare_term_data( $term_data['previous'], $this->get_taxonomy(), $this->get_term_namespace() );
$term_response->set_data( $data );
return $term_response;
}
Changelog
| Version | Description |
|---|---|
| 4.6 | Introduced. |