Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Created March 26, 2020 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchristopher/b19d4b1d6905c2e2116278d05f2883ce to your computer and use it in GitHub Desktop.
Save jchristopher/b19d4b1d6905c2e2116278d05f2883ce to your computer and use it in GitHub Desktop.
Add additional content to a specific Custom Field during indexing in SearchWP
<?php
// Add additional content to a specific Custom Field during indexing in SearchWP.
add_filter( 'searchwp\source\post\attributes\meta\my_custom_field_key', function( $meta_value, $args ) {
// Add 'coffee' to Custom Field value to make it searchable.
return $meta_value . ' coffee';
}, 20, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment