AND logic has been completely refactored to prevent potential false positives. You can also now filter where AND logic is applied. Allow me to explain:
Out of the box, SearchWP applies AND logic to entire posts. That is to say terms can appear in the title, content, excerpt, slug, anywhere. As long as all the terms appear somewhere the post is considered valid. There may be a use case, however, where this is too loose and you want to restrict AND matches to titles only. You can now do that easily by adding the following to your active theme’s functions.php
:
function mySearchWPANDFields( $fields )
{
$fields = array( 'title' ); // only apply AND to title
return $fields;
}
add_filter( 'searchwp_and_fields', 'mySearchWPANDFields' );
Available fields are:
title
content
slug
excerpt
comment
tax
meta
Full 1.4.6 changelog:
- [Improvement] More precise refactor of AND logic to prevent potential false positives
- [New] New Filter:
searchwp_and_fields
allows you to limit which field types apply to AND logic (i.e. limit to Title)