Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Ajax Search Pro for WordPress need help for our real estate website › Reply To: Ajax Search Pro for WordPress need help for our real estate website
August 7, 2023 at 10:14 am
#44945
Keymaster
Sure!
The property_agent field seems to be a reference field to developer posts, so I have added a custom code snippet to transform the values to the developer post titles for the index (the code is in the child theme functions.php):
add_filter( 'asp_post_custom_field_before_tokenize', 'asp_change_cf_index', 10, 3 );
function asp_change_cf_index( $values, $post, $field ) {
if ( $field == 'property_agent' ) {
$id = get_post_meta( $post->ID, 'property_agent', true);
if ( !is_wp_error($id) ) {
$values = array( get_the_title( $id ) );
}
}
return $values;
}
Now searching by developer should very likely return results for the properties.