Created
January 23, 2015 15:40
-
-
Save jchristopher/3f3038420876c71b42d7 to your computer and use it in GitHub Desktop.
Selectively omit post meta (Custom Fields) from being indexed by SearchWP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment