Function: _oembed_rest_pre_serve_request

_oembed_rest_pre_serve_request( boolean $served, WP_HTTP_ResponseInterface $result, WP_REST_Request $request, WP_REST_Server $server )

Hooks into the REST API output to print XML instead of JSON.

This is only done for the oEmbed API endpoint, which supports both formats.


Name Type(s) Default Value Description
$served boolean

Whether the request has already been served.

$result \WP_HTTP_ResponseInterface

Result to send to the client. Usually a WP_REST_Response.

$request WP_REST_Request

Request used to generate the response.

$server WP_REST_Server

Server instance.



WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.