SearchWP Documentation

View the installation guide, browse the Knowledge Base, find out about SearchWP’s many hooks

searchwp\query\args

Since: 4.0.0

Table of Contents

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

Parameters

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)
4.0.0
\SearchWP\Query $query The Query being run 4.0.0

Examples

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

Customize the Engine used for a Query

<?php
// 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