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

Reply To: Displaying Taxonomy term

#20848
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

Thank you, that helps!

I have found two issues. One is that the WPML compatibility was turned off, I had to enable it, so that the language argument is passed. The second issue is however is something else. For some reason, the language resets to the default (french) within WPML during the ajax requests, when not logged in. That affects the get_terms() function, and since there are no french tags, nothing is returned. I guess this is some sort of a cache related thing.

I had to add the following code to the functions.php file to force change the language for the logged in users. Please keep a copy of this:

add_action('asp_query_args', 'asp_force_wpml_lang', 10, 1);
function asp_force_wpml_lang($args) {
	if ( !empty($args['_wpml_lang']) ) {
		global $sitepress;
		$sitepress->switch_lang($args['_wpml_lang'], true);
	}
	return $args;
}

Now you should see the tags in the list.