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

Reply To: Horizontal search URL don't take correct language

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Horizontal search URL don't take correct language Reply To: Horizontal search URL don't take correct language

#28026
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

Looks like the wpml_permalink call is not resolving the URLs correctly. I looked up their documentation, and there seems to be a way to force that. This requires a bit of custom code, but should hopefully work.

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_results', 'asp_full_resolve_wpml', 10, 4);
function asp_full_resolve_wpml( $results, $id, $is_ajax, $args ) {
	foreach ( $results as $k => &$r ) {
		if ( isset($r->post_type) )
			$r->link = apply_filters( 'wpml_permalink', get_permalink($r->id), $args['_wpml_lang'], true );
	}           
	return results;
}

Let me know if it works.