Support

Account

Home Forums ACF PRO ACF PRO 5.6 & WPML – option page

Solving

ACF PRO 5.6 & WPML – option page

  • Hi everyone,

    Yesterday I updated ACF PRO from 5.5.14 to 5.6.0 and I had a few problems with my site. Now it’s ok but one problem was not solved. I use WPML on my site and I created option page with acf pro. I’m using two languages: polish (default) and english. When I enter to option page then have my custom fields but when I change language on english then nothing happens. I see just polish custom fields. I was looking errors and i tried a lot of methods. In the end I installed 5.5.14 version and everything is ok. Probably it’s a bug in the plugin. I can’t update the plugin so I waiting for a solution to the problem

  • Same problem here.
    A good workaround is probably the creation of language-aware option pages, not elegant but effective.

  • I also have the same problem with 5.6.
    5.5.14 is working fine so i’ll just wait for the next release to update it.
    Best regards.

  • – Subscribing

    I have the same problem.
    It looks like the field ID gets copied when translating the fields.
    This is causing problems when updating the field as it can only hold one value for one language.

  • Same here! I have upgraded to 5.6.0 and options page can’t switch to other languages…

    In frontend, on other langs, get_field( KEY, ‘options’ ) don’t change and return NULL.

    Please fix as soon as possible.

  • Yea, unfortunately WPML and ACF works nicely together ONLY if you don’t change “post_id” to something different than “options“, if you want to use something like “sidebars” for example, than translations for your options page stop working and updating options page on other language will overwrite other ones, or I assume it just updates it as not even trying to update for current language and separate from other ones 🙂

    I managed to fix this issue like this:

    // Get language suffix if not default language
    function getTheLang(){
            if( function_exists('icl_get_languages')){
                global $sitepress;
                $default_lang = $sitepress->get_default_language();
                $lang = ICL_LANGUAGE_CODE;
                if($lang != $default_lang) return '_'.$lang;
            }
            return '';
    }
    
    // Add custom options page
    acf_add_options_page(array(
                'page_title' => 'Sidebars composer',
                'menu_title' => 'Sidebars composer',
                'post_id' => 'sidebars' . getTheLang(),
                'parent_slug' => 'themes.php',
    ));

    To load a field, just add “getTheLang()” after your custom options “post_id”, like this for example:
    get_field( ‘sidebars’, ‘sidebars’ . getTheLang() );

    Nut much changed/hacked there, but this is works nicely 🙂

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘ACF PRO 5.6 & WPML – option page’ is closed to new replies.