apply_filters( 'rest_pre_dispatch', mixed $result, WP_REST_Server $this, WP_REST_Request $request )

Filters the pre-calculated result of a REST dispatch request.


Description Description

Allow hijacking the request before dispatching by returning a non-empty. The returned value will be used to serve the request instead.


Parameters Parameters

$result

(mixed) Response to replace the requested version with. Can be anything a normal endpoint can return, or null to not hijack the request.

$this

(WP_REST_Server) Server instance.

$request

(WP_REST_Request) Request used to generate the response.


Top ↑

Source Source

File: wp-includes/rest-api/class-wp-rest-server.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
4.4.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.