SearchWP

This Documentation is for SearchWP Version 3

Available since: 3.0

searchwp_partial_matches_lenient

View Parameters »

When partial matching is enabled, SearchWP will attempt to find partial matches regardless of whether an exact match was used in the search string.

You can prevent SearchWP from finding partial matches if there is an exact match using this hook:

<?php
// Prevent SearchWP from finding partial matches if an exact match is found.
add_filter( 'searchwp_partial_matches_lenient', function( $lenient, $args ) {
// $args['engine'] is the engine being used
return false; // true/false
}, 20, 2 );
view raw functions.php hosted with ❤ by GitHub

Parameters

Parameter Type Description
$lenient Boolean

Whether to find partial matches when exact matches are found

$args Array

$args['engine'] The engine being used