WP HOOKS
filtrod 4.4.0

rest_pre_serve_request

Args 4Plik wp-includes/rest-api/class-wp-rest-server.phpDokumentacja WP ↗

Opis — z kodu źródłowego

Filters whether the REST API request has already been served.

Allow sending the request manually - by returning true, the API result will not be sent to the client.

Parametry

ParametrTypOpis
$servedboolWhether the request has already been served. Default false.
$result\WP_HTTP_ResponseResult to send to the client. Usually a <code>WP_REST_Response</code>.
$request\WP_REST_RequestRequest used to generate the response.
$server\WP_REST_ServerServer instance.

Wywołanie

Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'rest_pre_serve_request', 'twoja_funkcja', 10, 4 );

function twoja_funkcja($param_1, $param_2, $param_3, $param_4) {
	// Twój kod
}

Popularne w tej kategorii