rest_pre_dispatch

rest_pre_dispatch

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.7.2

apply_filters('rest_pre_dispatch') is found 2 times:

  • /wp-includes/rest-api/class-wp-rest-server.php line 1078
    1074
    1075
    1076
    1077
    1078
    1079
    1080
    1081
    1082
    1083
    *                                 a normal endpoint can return, or null to not hijack the request.
     * @param WP_REST_Server  $server  Server instance.
     * @param WP_REST_Request $request Request used to generate the response.
     */
    $result = apply_filters( 'rest_pre_dispatch', null, $this, $request );
     
    if ( ! empty( $result ) ) {
     
        // Normalize to either WP_Error or WP_REST_Response...
        $result = rest_ensure_response( $result );
  • /wp-includes/rest-api/class-wp-rest-server.php line 1829
    1825
    1826
    1827
    1828
    1829
    1830
    1831
    1832
    1833
    1834
    1835
    $clean_request->set_attributes( array() );
    $clean_request->set_default_params( array() );
     
    /** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */
    $result = apply_filters( 'rest_pre_dispatch', null, $this, $clean_request );
     
    if ( empty( $result ) ) {
        $match = $matches[ $i ];
        $error = null;
     
        if ( is_wp_error( $validation[ $i ] ) ) {

See this hook used in plugins: