Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › slug problem › Reply To: slug problem
May 21, 2021 at 12:11 pm
#33358
Keymaster
Hi,
Tough questions, it should automatically return the correct URL as it is requested from WordPress, so the WPML filters should execute.
Try this custom code to force the WPML language filters:
add_filter('asp_results', 'asp_change_wpml_link_users', 10, 1);
function asp_change_wpml_link_users( $results, $id, $is_ajax, $args ) {
if ( $args['_wmpl_lang'] != '' ) {
foreach ( $results as $k => &$r ) {
if ( $r->content_type == 'user' ) {
$r->link = apply_filters('wpml_permalink', $r->link, $args['_wpml_lang'], true);
}
}
}
return $results;
}