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

Documentation

View the installation guide, browse the Knowledge Base, find out about SearchWP's many hooks, get support

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

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