Available since: 2.8.3
searchwp_search_args
View Parameters »You can use this hook to filter SearchWP’s search arguments in real time. The arguments are passed as a single parameter:
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 | |
// Customize SearchWP arguments when performing a search. | |
add_filter( 'searchwp_search_args', function( $args ) { | |
// $args['terms'] // The search terms for this request. | |
// $args['engine'] // The engine used for the search. | |
// $args['page'] // Which page of results to retrieve. | |
// $args['posts_per_page'] // How many posts per page to retrieve. | |
// $args['order'] // Sorting order of results (ASC or DESC). | |
// $args['load_posts'] // Whether to load the full WP_Post object for each result. | |
// TODO: Customize $args to match your needs. | |
return $args; | |
} ); |
Parameters
Parameter | Type | Description |
---|---|---|
$args |
Array |
|