rest_pre_dispatch

FILTER wp-includes\rest-api\class-wp-rest-server.php (ligne 1078) github
Filters the pre-calculated result of a REST API dispatch request. Allow hijacking the request before dispatching by returning a non-empty. The returned value will be used to serve the request instead.

Paramètres

Entrée :
null, $this, $request
Sortie :
@param mixed           $result  Response to replace the requested version with. Can be anything
@param WP_REST_Server  $server  Server instance.
@param WP_REST_Request $request Request used to generate the response.

Utilisation

// Modifier la valeur avec le filtre 'rest_pre_dispatch'
add_filter('rest_pre_dispatch', 'ma_fonction_filtre', 10, 1);

function ma_fonction_filtre(null) {
    // Modifier la valeur
    return null;
}

Actualités

Chargement des actualités...