Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: rest_pre_dispatch

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
807            * will be used to serve the request instead.
808            *
809            * @since 4.4.0
810            *
811            * @param mixed           $result  Response to replace the requested version with. Can be anything
812            *                                 a normal endpoint can return, or null to not hijack the request.
813            * @param WP_REST_Server  $this    Server instance.
814            * @param WP_REST_Request $request Request used to generate the response.
815            */
816           $result = apply_filters( 'rest_pre_dispatch', null, $this, $request );
817
818           if ( ! empty( $result ) ) {
819                return $result;
820           }
821
822           $method = $request->get_method();
823           $path   = $request->get_route();
824
825           foreach ( $this->get_routes() as $route => $handlers ) {