rest_pre_dispatch
Filter HookDescription
Serves the batch/v1 request.Hook Information
File Location |
wp-includes/rest-api/class-wp-rest-server.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1832 |
Hook Parameters
Type | Name | Description |
---|---|---|
WP_REST_Request
|
$batch_request
|
The batch request object. |
Usage Examples
Basic Usage
<?php
// Hook into rest_pre_dispatch
add_filter('rest_pre_dispatch', 'my_custom_filter', 10, 1);
function my_custom_filter($batch_request) {
// Your custom filtering logic here
return $batch_request;
}
Source Code Context
wp-includes/rest-api/class-wp-rest-server.php:1832
- How this hook is used in WordPress core
<?php
1827 $clean_request->set_url_params( array() );
1828 $clean_request->set_attributes( array() );
1829 $clean_request->set_default_params( array() );
1830
1831 /** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */
1832 $result = apply_filters( 'rest_pre_dispatch', null, $this, $clean_request );
1833
1834 if ( empty( $result ) ) {
1835 $match = $matches[ $i ];
1836 $error = null;
1837
PHP Documentation
<?php
/**
* Serves the batch/v1 request.
*
* @since 5.6.0
*
* @param WP_REST_Request $batch_request The batch request object.
* @return WP_REST_Response The generated response object.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/rest-api/class-wp-rest-server.php
Related Hooks
Related hooks will be displayed here in future updates.