SearchWP

This Documentation is for SearchWP Version 3

Available since: 2.0

searchwp_omit_meta_key

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:

<?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

Parameters

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

[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]