This Documentation is for SearchWP Version 3

Available since: 2.0


View Parameters »

Note: Use of this hook will require a manual reindex

By default SearchWP will index all Custom Fields (post meta) but with this hook you can selectively tell SearchWP to skip over any number of meta keys. To use this hook add something like the following to your theme’s functions.php:

function my_searchwp_omit_meta_key( $omit, $meta_key, $the_post ) {
// don't index anything marked as private (starts with _)
if ( '_' == substr( $meta_key, 0, 1 ) ) {
$omit = true;
return $omit;
add_filter( 'searchwp_omit_meta_key', 'my_searchwp_omit_meta_key', 10, 3 );
view raw gistfile1.php hosted with ❤ by GitHub


Parameter Type Description
$omit Boolean

Whether the current meta record should be omitted from the index

$meta_key String

The meta_key of the Custom Field

$the_post Object

The post object being indexed