Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › canot find users in translated language › Reply To: canot find users in translated language
February 17, 2021 at 2:28 pm
#31623
Keymaster
I really don’t know why it does not translate, WPML should do it automatically, this is how it should actually work by their documentation. Maybe try this last version:
add_filter( 'asp_results', 'asp_get_author_data', 10, 1 );
function asp_get_author_data( $results ) {
// Parse through each result item
foreach ($results as $k=>&$r) {
if ( $r->content_type == 'user' ) {
$r->title = icl_t('Authors', 'display_name_'.$r->id, get_the_author_meta('display_name', $r->id));
$r->content = icl_t('Authors', 'description_'.$r->id, get_the_author_meta('description', $r->id));
}
}
return $results;
}