Skip to content

Instantly share code, notes, and snippets.

Created December 2, 2016 03:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/ce5c095429400cb98e1449bd08e7dc09 to your computer and use it in GitHub Desktop.
Save anonymous/ce5c095429400cb98e1449bd08e7dc09 to your computer and use it in GitHub Desktop.
function my_searchwp_omit_meta_key( $omit, $meta_key, $the_post ) {
$url_meta = 'link-url';
$url_found = strpos($meta_key,$url_meta);
// if "link-url" is in a custom field meta key name, do not index it
if ($url_found == true) {
$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