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