WP_REST_Terms_Controller::get_item() public WP 4.7.0
Gets a single term from a taxonomy.
{} It's a method of the class: WP_REST_Terms_Controller{}
No Hooks.
Return
WP_REST_Response/WP_Error. Response object on success, or WP_Error object on failure.
Usage
$WP_REST_Terms_Controller = new WP_REST_Terms_Controller(); $WP_REST_Terms_Controller->get_item( $request );
- $request(WP_REST_Request) (required)
- Full details about the request.
Changelog
Since 4.7.0 | Introduced. |
Code of WP_REST_Terms_Controller::get_item() WP REST Terms Controller::get item WP 5.6
public function get_item( $request ) {
$term = $this->get_term( $request['id'] );
if ( is_wp_error( $term ) ) {
return $term;
}
$response = $this->prepare_item_for_response( $term, $request );
return rest_ensure_response( $response );
}