Home › Forums › ACF PRO › WPML: Get field from options from specific/other-than-active languages › Reply To: WPML: Get field from options from specific/other-than-active languages
ciao physalis
i had the same issue just now, using do_action( 'wpml_switch_language', $language );
to change language in an ajax call. but acf options was always returning the ‘original’ language, that was loaded on the inital load.
i now also added this right after the do_action call:
add_filter('acf/settings/current_language', 'jnz_acf_set_language');
and here is the corresponding function:
function jnz_acf_set_language() {
return apply_filters( 'wpml_current_language', null );
}
this sets the acf language to the current language, but you could also simply return ‘en’ or whatever you prefer..
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.