Home › Forums › ACF PRO › WPML, ACF 5.0.9 and Options Page › Reply To: WPML, ACF 5.0.9 and Options Page
I’ve made some modifications so I’m not limited to a single get_field wrapper function, and you don’t have to put the filter code in your page template.
<?php
/**
* functions.php
*/
if ( !function_exists( 'yourprefix_acf_get_language_default' ) )
{
function yourprefix_acf_get_language_default()
{
return acf_get_setting( 'default_language' );
}
}
if ( !function_exists( 'yourprefix_acf_set_language_to_default' ) )
{
function yourprefix_acf_set_language_to_default()
{
add_filter( 'acf/settings/current_language', 'yourprefix_acf_get_language_default', 100 );
}
}
if ( !function_exists( 'yourprefix_acf_unset_language_to_default' ) )
{
function yourprefix_acf_unset_language_to_default()
{
remove_filter( 'acf/settings/current_language', 'yourprefix_acf_get_language_default', 100 );
}
}
/**
* page template
*/
yourprefix_acf_set_language_to_default();
// use any acf function like normal
yourprefix_acf_unset_language_to_default();
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!
The most recent ACF Chat Friday featured a live demo of how to register CPTs directly in the plugin, one of our most requested features. Check out the summary below for a replay of the demo, and don’t forget to register for the next session! https://t.co/k2KQ3WWBAz
— Advanced Custom Fields (@wp_acf) March 9, 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.