Prepares a taxonomy object for serialization.
public prepare_item_for_response ( stdClass $taxonomy, WP_REST_Request $request ) : WP_REST_Response | ||
$taxonomy | stdClass | Taxonomy data. |
$request | WP_REST_Request | Full details about the request. |
return | WP_REST_Response | Response object. |
public function test_prepare_item() { $tax = get_taxonomy('category'); $endpoint = new WP_REST_Taxonomies_Controller(); $data = $endpoint->prepare_item_for_response($tax, new WP_REST_Request()); $this->check_taxonomy_object($tax, $data); }
public function test_prepare_item() { $tax = get_taxonomy('category'); $endpoint = new WP_REST_Taxonomies_Controller(); $request = new WP_REST_Request(); $request->set_param('context', 'edit'); $response = $endpoint->prepare_item_for_response($tax, $request); $this->check_taxonomy_object('edit', $tax, $response->get_data(), $response->get_links()); }