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: 1.4.6

searchwp_and_fields

View Parameters »

By default, SearchWP checks all field types when performing AND logic, but you can customize which field types are considered if you’d like.

Example: To have SearchWP only consider post titles and main content when performing AND logic, add the following to your active theme’s functions.php:

<?php
function my_searchwp_and_fields() {
return array( 'title', 'content' );
}
add_filter( 'searchwp_and_fields', 'my_searchwp_and_fields' );
view raw gistfile1.php hosted with ❤ by GitHub

Parameters

Parameter Type Description
$and_field_defaults Array

The default field types considered during AND passes [ 'title', 'content', 'slug', 'excerpt', 'comment', 'tax', 'meta' ]

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