Home Forums ACF PRO WPML, ACF 5.0.9 and Options Page


WPML, ACF 5.0.9 and Options Page

  • With the last WPML ( and ACF 5.0.9 all the options page field return NULL in the secondary language.

  • I assume this has to do with the latest versions
    “Options page: Added compatibility for different language values”

    I came here to find out in what way this has been achieved so maybe I’ll get the answer here too 🙂

  • I’ve been waiting for this release as well, but now that it’s here i can’t find how to translate an options page? Can Elliott or anyone else explain how to start translating it? 🙂

  • I have the same problem. I had everthing set up so the things that don’t need translation would get the value from the original language, now I have to translate everything. The way I set it up was to have options pages (via the “acf_add_options_page” function) in the other languages and i appended the languagecode to the fields that needed to be translated and used ICL_LANGUAGE_CODE to get the correct field for the language. I believe the way it is set up now you don’t have to use the ICL_LANGUAGE_CODE anymore, however now I have to translate everything… I don’t think that that was the intention of who suggested the code.

    I use $field = get_field(‘your field’, option); and it translates the fields, but I don’t want to have to translate things that can be the same in other languages (like telephonenumbers).
    Please can someone enlighten us?

  • Hello, same probleme the options page field return NULL in the secondary language. I think Jonathan is right this is the lastest versions.

  • I would love to use this functionality, but i don’t get how to use it. Can anybody please explain to me, how i should set up the acf_add_options_page? I want this feature (“Options page: Added compatibility for different language values” ) for a current project I’m working on.
    (working with WPML 3.1.6 and ACF_Pro 5.0.9)

  • Sorry, my bad. I found it. Just changed the main language in the WordPress Admin Bar. Maybe this helps anybody else, too.

    I was searching for a posibility to activate the languages. They are activated by default. And there is no language switch like on pages e.g. english(13) german(12).

    It was to easy…. Thank you for your excellent work

  • Aaah! PERFECT! Thank you Jochen!!!

  • I am also getting NULL when using get_field(‘example_field’, ‘option’) in the secondary language, is there a workaround for those of us who don’t want to translate options? Sometimes it’s just not necessary, like for phone numbers, email address, contact info, custom settings parameters, etc

  • Hi,

    I have the same problem with ACF 5.1.5 and WPML
    As pointed out by brian1037, I’d rather avoid to translate in more than 5 languages prices, dates and other numerical data or tables.

    I used Option fields just to fill in these fields only once for the whole website.

    But now I have all these fields empty in languages different from default.
    Hope it could be fixed soon,


  • I agree there has to be a setting for this. I think it should check if that field is actually translated in the options group settings. If so, the way it works now is good. If not, it should always fall back to the original language.

    Quick fix for people that need it working now:
    Add this just before your get_field() function, where ‘en’ is your default language. Call the filter again with the current language to reset it again, so it wont affect pages and stuff.

    // add this
    add_filter('acf/settings/current_language',function() {
         global $sitepress;
         return $sitepress->get_default_language();
    // this is already in your code
    $my_field =  get_field('my_field', 'option');
    // reset to original language
    add_filter('acf/settings/current_language',function() {
         return ICL_LANGUAGE_CODE;
  • Hi,

    My problem starts with the problem of saving different values for different languages in the Options page

    Let me describe what I need with my option page.

    – A text field
    – A dropdown of pages present in the current language. These are visible when changing the WP-Admin language using the switch.

    The workaround would be to give all the fields a different fieldname like “OPERATIECREATIE” said in his post. And adding a lot of code in the frontend

    Please help.

  • This is such a mess. I only got to know you cannot have options pages holding both the wordings for the first and the second language through a customer that complained about elements not being visible anymore on their website, and it must have already been weeks since it is defective. This is actually not the first time that something like that occured, but it is rather annoying.
    I would love to get notified in a way when such changes occur; I like the idea but would love to decide in what I way I want it, especially for sites with multiple languages. Now I have to check every project whether it still behaves or not.

  • Thanks for this JoepR! I tried the same approach but didn’t know the right ACF filter.

    I agree with the concerns here. I also have an issue with the new ACF version that Options now have to be translated or else return null. It breaks websites.
    Yes you can add in translated options, but most of the time translation is the same and there’s no way to duplicate. I have sites with many many options, it takes a lot of time to reinsert everything, and the customers don’t understand the logic at all.

    I tried setting the CMS to ‘All Languages’ in the admin bar, inserted all options, but sadly this doesn’t work either.

    The filter workaround works, but it’s ugly. This should have been be though through better before making such a release.

    I’ve been trying to get an answer from support for over a month but the last reply was the I should contact WPML…

  • Hi everyone,

    I believe I have a more or less decent looking workaround for this issue, based on the same idea JoepR had. It allows you to mark any number of options pages as “global”, i.e. they are not translatable and will always display the options in the default language. All other options pages would remain translatable.

     * Create the options page that we will later set "global"
          'page_title'  => 'Test',
          'menu_title'  => 'Test',
          'menu_slug'   => 'test',
     * Force ACF to use only the default language on some options pages
    function cl_set_global_options_pages($current_screen) {
      // IDs of admin options pages that should be "global"
      $page_ids = array(
      if (in_array($current_screen->id, $page_ids)) {
        add_filter('acf/settings/current_language', 'cl_acf_set_language', 100);
    add_action( 'current_screen', 'cl_set_global_options_pages' );
    function cl_acf_set_language() {
      return acf_get_setting('default_language');
     * Wrapper around get_field() to get the "global" option values.
     * This is the function you'll want to use in your templates instead of get_field() for "global" options.
    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;

    I’d appreciate any feedback on the concept. Couldn’t figure out any scenarios where it would break, but maybe I missed something.

  • Thanks indrek_k will give this a go, have you had any trouble with it? Such a shame the options pages do not work correctly with multi language, I never realised what a pain using WPML would be, wish they would update the UI, it looks/feels so clunky.

  • We’ve had no trouble so far, but haven’t had the chance to test on a more complex project yet.

    But yes, WPML is pretty bad 🙁
    We are currently testing Polylang which looks like a good alternative so far. Will write a review once we’re done with the project.

  • @indrek_k I’ve tried your solution.
    I already have option page full of fields of different kind (repeater, flexible content, galleries, …).
    After adding your code I lost every values already entered and I had to fill in again each field. Maybe since I already filled in before making this option page “global”?
    What about have_rows and other ACF functions for flexible contents and repeaters?

    Eventually I restored the backup and removed WPML. I own the DEV license but it’s increasingly complex to have a perfect multilingual website with WPML and ACF.
    I often used options pages to store numerical data, which don’t need any translation.
    I switched to Polylang but I’m having some issues with Gallery fields. I open a new ticket about this.


  • Thanks indrek_k!
    I tried to use your wrapper function only but got some problems with repeater data.

  • I didn’t consider repeater and flexible content fields so yes, this probably won’t work with them. There’s probably a pretty easy way to make them functional though – I’ll look into that once I have some time.

  • I’ve simple used a workaround related to your little function.
    The problems with repeater and flexible coming with functions ‘have_rows()’ and ‘the_row()’. It’s like using the loop, outside the loop.

    // Set language to default
    add_filter('acf/settings/current_language', 'cl_acf_set_language', 100);
    // check if the repeater field has rows of data
    if( have_rows('repeater_field_name') ):
     	// loop through the rows of data
        while ( have_rows('repeater_field_name') ) : the_row();
            // display a sub field value
    else :
        // no rows found
    // Set language to current
    remove_filter('acf/settings/current_language', 'cl_acf_set_language', 100);

    I see right now a better solution would be to use repeater/flexible content data as an array. It should work that way, i guess.

  • 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.

     * 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
    // use any acf function like normal
Viewing 22 posts - 1 through 22 (of 22 total)

The topic ‘WPML, ACF 5.0.9 and Options Page’ is closed to new replies.