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

searchwp_and_fields_{$post_type}

View Parameters »

This hook runs prior to searchwp_and_fields and accomplishes the same goal, but with additional context. The return value of this hook will be inherited by searchwp_and_fields.

<?php
add_filter( 'searchwp_and_fields_post', function( $and_fields, $engine ) {
// TODO: Customize $and_fields to match what you want for Posts (and not other post types).
// @link https://searchwp.com/docs/hooks/searchwp_and_fields/
return $and_fields;
}, 20, 2 );
view raw functions.php hosted with ❤ by GitHub

Parameters

Parameter Type Description
$and_fields 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