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 6, 2020 at 3:23 pm
#27145
Keymaster
Well, try this custom code then:
add_filter( 'asp_results', 'asp_custom_images_gr', 10, 4 );
function asp_custom_images_gr( $results, $id, $is_ajax, $args ) {
foreach ($results as $k=>&$r) {
if ( $r->content_type == 'user' ) {
$s = get_user_meta( $r->id, 'wcfmmp_profile_settings', true );
if ( isset($s['gravatar']) ) {
$r->image = get_avatar_url($s['gravatar']);
}
}
}
return $results;
}
I suspect that this may not work though, usually gravatars are handled by WordPress internally, and the search should already return them when they are enabled – but it’s worth a try.