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 |
---|---|
944 | * will be used to serve the request instead. |
945 | * |
946 | * @since 4.4.0 |
947 | * |
948 | * @param mixed $result Response to replace the requested version with. Can be anything |
949 | * a normal endpoint can return, or null to not hijack the request. |
950 | * @param WP_REST_Server $server Server instance. |
951 | * @param WP_REST_Request $request Request used to generate the response. |
952 | */ |
953 | $result = apply_filters( 'rest_pre_dispatch', null, $this, $request ); |
954 |
|
955 | if ( ! empty( $result ) ) { |
956 | return $result; |
957 | } |
958 |
|
959 | $error = null; |
960 | $matched = $this->match_request_to_handler( $request ); |
961 |
|
962 | if ( is_wp_error( $matched ) ) { |
Line | Code |
1640 | } |
1641 |
|
1642 | foreach ( $requests as $i => $single_request ) { |
1643 | $clean_request = clone $single_request; |
1644 | $clean_request->set_url_params( array() ); |
1645 | $clean_request->set_attributes( array() ); |
1646 | $clean_request->set_default_params( array() ); |
1647 |
|
1648 | /** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */ |
1649 | $result = apply_filters( 'rest_pre_dispatch', null, $this, $clean_request ); |
1650 |
|
1651 | if ( empty( $result ) ) { |
1652 | $match = $matches[ $i ]; |
1653 | $error = null; |
1654 |
|
1655 | if ( is_wp_error( $validation[ $i ] ) ) { |
1656 | $error = $validation[ $i ]; |
1657 | } |
1658 |
|