Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Use of users custom fields in a product search › Reply To: Use of users custom fields in a product search
May 5, 2020 at 2:18 pm
#27109
Keymaster
Okay, if these are indeed the author metadata, then this custom code may do the trick:
Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!
add_filter('asp_post_content_before_tokenize', 'vendor_asp_post_content_before_tokenize', 10, 2);
function vendor_asp_post_content_before_tokenize($content, $the_post) {
$meta_fields = array(
'_store_description',
'store_name',
'wcfm_vendor_store_hours',
'store_email',
'phone',
'payment',
'wcfm_store_hours',
'wcfm_shipping_policy',
'wcfm_vacation_mode',
'store_location',
'wcfmmp_store_name'
);
foreach ( $meta_fields as $field ) {
$s = get_user_meta( $the_post->post_author, $field, true );
if ( !empty($s) ) {
$content .= ' ' . $s;
}
}
return $content;
}
After that, you will have to re-create the index table. You will find all the information in this documentation.