Available since: 2.0.3
searchwp_get_custom_fields
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
:
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_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 ); |
Parameters
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 |