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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} ); |