searchwp\swp_query\args
Depuis : 4.0.0
Table des matières
Modifier les arguments utilisés lors de l'instanciation de SWP_Query.
Paramètres
| Type | Paramètre | Défaut | Depuis |
|---|---|---|---|
| Tableau | $args |
Les arguments soumis pour cette instanciation | 4.0.0 |
Exemples
All hooks should be added to your custom SearchWP Customizations Plugin.
Restreindre les résultats aux articles et aux pages
This file contains hidden or 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; | |
| } ); |

