WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
Line | Code |
---|---|
943 | * will be used to serve the request instead. |
944 | * |
945 | * @since 4.4.0 |
946 | * |
947 | * @param mixed $result Response to replace the requested version with. Can be anything |
948 | * a normal endpoint can return, or null to not hijack the request. |
949 | * @param WP_REST_Server $server Server instance. |
950 | * @param WP_REST_Request $request Request used to generate the response. |
951 | */ |
952 | $result = apply_filters( 'rest_pre_dispatch', null, $this, $request ); |
953 |
|
954 | if ( ! empty( $result ) ) { |
955 | return $result; |
956 | } |
957 |
|
958 | $error = null; |
959 | $matched = $this->match_request_to_handler( $request ); |
960 |
|
961 | if ( is_wp_error( $matched ) ) { |
Line | Code |
1594 | } |
1595 |
|
1596 | foreach ( $requests as $i => $single_request ) { |
1597 | $clean_request = clone $single_request; |
1598 | $clean_request->set_url_params( array() ); |
1599 | $clean_request->set_attributes( array() ); |
1600 | $clean_request->set_default_params( array() ); |
1601 |
|
1602 | /** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */ |
1603 | $result = apply_filters( 'rest_pre_dispatch', null, $this, $clean_request ); |
1604 |
|
1605 | if ( empty( $result ) ) { |
1606 | $match = $matches[ $i ]; |
1607 | $error = null; |
1608 |
|
1609 | if ( is_wp_error( $validation[ $i ] ) ) { |
1610 | $error = $validation[ $i ]; |
1611 | } |
1612 |
|