guideplugin/result/query_args
Change the WP_Query args for a guide
guideplugin/result/query_args
Definition
With this filter you can change the WP_Query args for a guide.
This filter should be used with care. You change not only the final result but also all partial results of each filter in the guide.
Parameters
apply_filters('guideplugin/result/query_args', $args, $guide_id);
Parameter | Type | Description |
---|---|---|
$args | array | WP_Query args |
$guide_id | int | The ID of the guide |
Important Note
The following query attributes cannot be changed with this filter:
fields
posts_per_page
suppress_filters
Example
The example shows you how to customize the WP_Query args for a certain guide:
<?php
function my_guide_result_query_args($args, $guide_id) {
// The guide result you want to modify
if ($guide_id == 24) {
$args['post_type'] = 'any';
}
return $args;
}
add_filter('guideplugin/result/query_args', 'my_guide_result_query_args', 10, 2);
Usage Scenarios
Custom Query Logic
Modify how WordPress queries for results
Advanced Filtering
Add meta queries or custom sorting
Performance Tuning
Optimize queries for specific use cases