searchwp\swp_query\args
Since: 4.0.0
Table of Contents
Modify the arguments used when instantiating SWP_Query.
Parameters
| Type | Parameter | Default | Since |
|---|---|---|---|
| Array | $args |
The submitted arguments for this instantiation | 4.0.0 |
Examples
All hooks should be added to your custom SearchWP Customizations Plugin.
Restrict results to Posts and Pages
| <?php | |
| // Restrict results to Posts and Pages for SearchWP's SWP_Query. | |
| add_filter( 'searchwp\swp_query\args', function( $args ) { | |
| $args['post_type'] = [ 'post', 'page' ]; | |
| return $args; | |
| } ); |

