SearchWP

This Documentation is for SearchWP Version 3

Available since: 1.0.8

searchwp_pre_search_terms

View Parameters »

If you would like to change the submitted search terms before they are sent to the search algorithm, use this filter.

Note: This filter is applied after term sanitization has taken place, unlike searchwp_terms.

Example: To alter the search terms submitted to the search algorithm, add the following to your active theme’s functions.php:

<?php
function my_searchwp_pre_search_terms( $terms, $engine ) {
if ( 'myengine' == $engine ) {
// do something with the terms
}
return $terms;
}
add_filter( 'searchwp_pre_search_terms', 'my_searchwp_pre_search_terms', 10, 2 );
view raw gistfile1.php hosted with ❤ by GitHub

Parameters

Parameter Type Description
$terms Array

The submitted search terms (after they have been sanitized)

$engine String

The search engine being used

[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]