Note: You are viewing the documentation for Version 4View Version 3 Docs


Since: 4.0.0

Table of Contents

Customize the arguments for a \SearchWP\Query which is used to perform all search queries.


Type Parameter Default Since
Array $args
Key Type Value
engine String Engine name
mods \SearchWP\Mod[] Mods for this Query
site Integer[] Site(s) to search
per_page Integer Number of results per page
page Integer Page of results
offset Integer Offset for pagination
fields String Field(s) to return (see Arguments)
\SearchWP\Query $query The Query being run 4.0.0


All hooks should be added to your custom SearchWP Customizations Plugin.

Customize the Engine used for a Query

// Customize the Engine used for a SearchWP Query.
add_filter( 'searchwp\query\args', function( $args, $query ) {
$args['engine'] = 'supplemental'; // Engine name.
return $args;
}, 20, 2 );

How to use this code

Fix keyword search on your site. No coding required!

Now you can utilize all of the content that's gone unrecognized by native WordPress keyword search instantly with SearchWP

Get SearchWP