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

searchwp\query\partial_matches\force

Since: 4.0.0

Table of Contents

Force SearchWP to execute its partial matching logic despite results being found.

Parameters

Type Parameter Default Since
Boolean $force false 4.0.0
Array $args
Key Type Value
tokens String[] Tokens for this search
query \SearchWP\Query The Query taking place
4.0.0

Examples

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

Force partial match logic when searching

By default partial logic is not applied if matches are found, but it can be forced

<?php
// Force partial matches in SearchWP even when matches are found using provided search.
add_filter( 'searchwp\query\partial_matches\force', function( $force, $args ) {
return true;
}, 10, 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