filtrod 4.4.0
rest_pre_serve_request
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
| Parametr | Typ | Opis |
|---|---|---|
$served | bool | Whether the request has already been served. Default false. |
$result | \WP_HTTP_Response | Result to send to the client. Usually a <code>WP_REST_Response</code>. |
$request | \WP_REST_Request | Request used to generate the response. |
$server | \WP_REST_Server | Server 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
}
// 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