This Documentation is for SearchWP Version 3

Available since: 2.0.3


View Parameters »

When SearchWP indexes a post object, it retrieves all of the metadata for that object. If you would like to manipulate that Custom Field data in any way, you can use this hook like so, by adding something like the following to your theme’s functions.php:

function my_searchwp_get_custom_fields( $custom_fields, $post_id ) {
// manipulate the array of Custom Fields in any way you'd like
return $custom_fields;
add_filter( 'searchwp_get_custom_fields', 'my_searchwp_get_custom_fields', 10, 2 );
view raw gistfile1.php hosted with ❤ by GitHub


Parameter Type Description
$custom_fields Array

The postmeta (Custom Fields) for the post being indexed

$post_id Integer

The ID of the post being indexed