rest_post_format_search_query
Filter HookDescription
Filters the query arguments for a REST API post format search request. Enables adding extra arguments or setting defaults for a post format search request.Hook Information
File Location |
wp-includes/rest-api/search/class-wp-rest-post-format-search-handler.php
View on GitHub
|
Hook Type | Filter |
Line Number | 61 |
Hook Parameters
Type | Name | Description |
---|---|---|
array
|
$query_args
|
Key value array of query var to query value. |
WP_REST_Request
|
$request
|
The request used. |
Usage Examples
Basic Usage
<?php
// Hook into rest_post_format_search_query
add_filter('rest_post_format_search_query', 'my_custom_filter', 10, 2);
function my_custom_filter($query_args, $request) {
// Your custom filtering logic here
return $query_args;
}
Source Code Context
wp-includes/rest-api/search/class-wp-rest-post-format-search-handler.php:61
- How this hook is used in WordPress core
<?php
56 * @since 5.6.0
57 *
58 * @param array $query_args Key value array of query var to query value.
59 * @param WP_REST_Request $request The request used.
60 */
61 $query_args = apply_filters( 'rest_post_format_search_query', $query_args, $request );
62
63 $found_ids = array();
64 foreach ( $format_slugs as $format_slug ) {
65 if ( ! empty( $query_args['search'] ) ) {
66 $format_string = get_post_format_string( $format_slug );
PHP Documentation
<?php
/**
* Filters the query arguments for a REST API post format search request.
*
* Enables adding extra arguments or setting defaults for a post format search request.
*
* @since 5.6.0
*
* @param array $query_args Key value array of query var to query value.
* @param WP_REST_Request $request The request used.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/rest-api/search/class-wp-rest-post-format-search-handler.php
Related Hooks
Related hooks will be displayed here in future updates.