This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: slug problem

#33358
Ernest MarcinkoErnest Marcinko
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;
}