rest_authorization_required_code() ) ); } return true; } /** * Get the default REST API version. * * @return string */ protected function get_api_version() { return 'v4'; } /** * Prepare a response for inserting into a collection. * * @param WP_REST_Response $response Response object. * @return array Response data. */ public function prepare_response_for_collection( $response ) { if ( ! ( $response instanceof WP_REST_Response ) ) { return $response; } $data = (array) $response->get_data(); $server = rest_get_server(); $links = $server->get_compact_response_links( $response ); if ( ! empty( $links ) ) { $data['_links'] = $links; } return $data; } /** * Get the base schema for the API. * * @return array */ protected function get_base_schema() { return array( '$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => 'base', 'type' => 'object', 'properties' => array(), ); } }