Home › Forums › ACF PRO › Trying to return a user dependent language › Reply To: Trying to return a user dependent language
I have a way to do it, but it isn’t the most ideal one, because it’s not DRY.
if ( 'nl' == $key ) {
add_filter( 'acf/settings/current_language', function() {
return 'nl';
} );
} elseif ( 'en' == $key ) {
add_filter( 'acf/settings/current_language', function() {
return 'en';
} );
} else {
add_filter( 'acf/settings/current_language', function () {
global $sitepress;
return $sitepress->get_default_language();
} );
}
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.