Home › Forums › General Issues › Get Option from WPML default language › Reply To: Get Option from WPML default language
Yeah, put this in your functions.php:
/**
* Advanced Custom Fields Options function
* Always fetch an Options field value from the default language
*/
function cl_acf_set_language() {
return acf_get_setting('default_language');
}
function get_global_option($name) {
add_filter('acf/settings/current_language', 'cl_acf_set_language', 100);
$option = get_field($name, 'option');
remove_filter('acf/settings/current_language', 'cl_acf_set_language', 100);
return $option;
}
Then for usage, it’s: get_global_option('phone_number');
Credit goes to indrek_k in this thread: http://support.advancedcustomfields.com/forums/topic/wpml-acf-5-0-9-and-options-page/
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!
ACF PRO’s Flexible Content field allows you to create smaller pieces of UI and compose them into whole flexible patterns. In our latest article, we show how to use it to create swappable site sections and integrate it all in a theme.https://t.co/ZRocH8oJSp
— Advanced Custom Fields (@wp_acf) January 24, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.