Note: You are viewing the documentation for Version 3View Version 4 Docs


View the installation guide, browse the Knowledge Base, find out about SearchWP's many hooks, get support

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

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