This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This thread is resolved. Here is a description of the problem and solution.

Problem: User was not able to translate options page created with ACF Pro Solution: Fixed in the ACFML 1.0.1

This topic contains 20 replies, has 4 voices.

Last updated by fabriceV-2 9 months, 3 weeks ago.

Assigned support staff: Jamal.

Author Posts
December 23, 2018 at 6:20 pm #3029010

guyt-2

I am trying to: Duplicate the options page field group to the translated language.

I expected to see:
All the fields in the options page at the translated language.

Instead, I got:
Empty field group. I can see the fields group title but no fields below it. (see attachment).

Notes:
1. all my fields are marked as "tranlstaeble" at the WPML settings page.
2. I tried to delete the fields group from the translated language and duplicate it again several time and it didnt work.
3. on the functions page my code for the options page looks like this:
/**
* Add options page for acf.
*/
add_action('acf/init', 'my_acf_init');

function my_acf_init() {

if( function_exists('acf_add_options_page') ) {

acf_add_options_page(array(
'page_title' => 'Theme Settings',
'menu_title' => 'Theme Settings',
'menu_slug' => 'theme-settings',
'capability' => 'edit_posts',
'redirect' => false
));
}

}
4. This is not the first time I am working with acf and WPML and it always woked fine. I think the issue started from the last update.
5. I am not using the 5.0 WP cause the gutenberg is not compatible for the acf plugin.

December 25, 2018 at 10:37 am #3032089

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Thank you for contacting WPML Support. My apologies for the late reply.
Please check if you have translated the field group, this documentation may help.
https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/#translating-field-groups-and-fields

Please user __() in your code as per this article in translation section.
hidden link

/**
* Add options page for acf.
*/
add_action('acf/init', 'my_acf_init');

function my_acf_init() {

  if( function_exists('acf_add_options_page') ) {

    acf_add_options_page(array(
      'page_title' => __('Theme Settings', 'my_text_domain'),
      'menu_title' => __(''Theme Settings', 'my_text_domain'),
      'menu_slug' => 'theme-settings',
      'capability' => 'edit_posts',
      'redirect' => false
    ));
  }

}

If this does not help, we will need to exclude the possibility of conflict with the theme or another plugin. Please check if this issue appears when:
- Only WPML plugins are activated. It will tell us if there is an interaction issue with other plugin.
- Theme is set to a WordPress default like Twenty Fourteen. Its will tell us if there is an interaction issue with your theme.
- If the problem disappears, start activating one at the time to track where the incompatibility is produced.

If this does not help, please go through the WPML->Support->Troubleshooting page.
And let me know what you get.

Jamal
WPML Support

December 25, 2018 at 10:57 am #3032127

guyt-2

Hi Jamal,
I have translated the fields groups and also already tried to deactivate all unnecessary plugins. If I turn off the theme then the options page wont show , I really dont think this is the iisue because I work with your plugin a lot and it never happened until the recent WP update and plugins update.
This is not the only issue I have on the same website. please see topic:
https://wpml.org/forums/topic/acf-fields-breaking-translated-terms-list-on-admin/

December 25, 2018 at 11:31 am #3032187

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Thank you for your feedback, i have created a test server, so we could investigate this further.
Login informations are provided in the previous private message.
Please upload your theme and use minimal plugins to reproduce this error.

I would also like your site locally. if possible create a snapshot of your site. We usually recommend the free Plugin “Duplicator” for this purpose.

If you already know how Duplicator works
(http://wordpress.org/plugins/duplicator/),
please skip the following steps and just send me the installer file and the zipped package you downloaded.

★ Duplicator Instructions
hidden link

If the file is too large (more than 200M), please use the Duplicator file filters to remove the cache, the wp-uploads directory, the media and the archive files.

Send me both files (you probably want to use DropBox, Google Drive, or similar services, as the snapshot file will be quite big)

I will enable your next answer as private so you can provide me the information securely.

Once the problem is resolved I will delete the local site.

Jamal
WPML Support

December 25, 2018 at 12:38 pm #3032207

guyt-2

hi Jamal,

I am uploading the theme right now. do you need only the theme? what about the DB?

also, I want to share a link to the archive of the duplicator, how can I make it private?

December 25, 2018 at 2:02 pm #3032297

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Please use a service like DropBox or Google Drive, share a folder with people having url. And paste the url in the private box.
This would help me to almost replicate your site, and will be helpful if we could not reproduce the error on the test server.

The server i provided, is a "clean install". If we can reproduce the error on it, this means it is a bug and we will escalate this issue to our developers.
I will kindly ask you to try to reproduce this error in the test server i have provided.

Please share with me a short video, i can follow to reproduce the error.

Thank you,
Jamal
WPML Support

December 25, 2018 at 2:13 pm #3032308

guyt-2

hi Jamal ,
I can send you the link to the archive directly from the website without any need to upload it to dropbox or drive . I cannot find any private box... where can I find it?

December 25, 2018 at 2:27 pm #3032313

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

You can use my email (jamal.b(at)onthegosystems.com). I also activated the private box.

Also, please, try to reproduce the error in the test server.

Jamal
WPML Support

December 25, 2018 at 2:31 pm #3032315

guyt-2

hi Jamal,
I made the settings on the clean version.
For now I added the options page and added the custom fields for it.
Some problems:
1. I couldn't change the user language to English but I guess it doesn't really matter cause you are using a different user anyway.

2. The table for the acf fields translations on the WPML settings remains empty for some reason (it didn't happen on my original version).

3. Same issue remains, there are no fields on the settings page on the translated language... only a tab and nothing beneath it.

now I will try the issue with the terms list.

December 25, 2018 at 4:19 pm #3032464

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

I was able to see the Group field you added in "Theme Settings" Page.
I will escalate this ticket to our 2nd tier support team and give you a feedback as soon as possible.
Feel free to reply to this thread, and i will keep you updated as soon as possible.

Thank you very much,
Jamal
WPML Support

December 25, 2018 at 5:19 pm #3032544

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

After discussing this with the team, it seems that there is no fix for this issue right now, it has been reported to the development team and a fix is not yet scheduled to be released.
Otherwise there is a workaround that was suggested by the ACF support to another user. lease see the resolved summery (top yellow section) at the link to the other ticket.
https://wpml.org/forums/topic/force-synch-of-some-custom-fields-between-languages/

I hope that this information is helpful to you.

Jamal
WPML Support

December 26, 2018 at 4:59 pm #3034643

guyt-2

Hi Jamal,

So the solution is to not translate the fields on the option page? that means that what is going to be updated on the default language will be displayed on the translated language? this is not a very good solution because I have text fields that should be filled in different languages by the admin...
Hope I understood right...

December 27, 2018 at 10:26 am #3036417

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Please accept my apologies, i did not explain my answer very well. I think i understand you want to translate theme options in other languages.

According to ACF Support, options pages uses "post_id", by default it is set to "options", ACF use language suffix too. "options" apparently has issues with WPML.
Let's consider the following code:

/**
* Add options page for acf.
*/
add_action('acf/init', 'my_acf_init');
 
function my_acf_init() {
 
  if( function_exists('acf_add_options_page') ) {
 
    acf_add_options_page(array(
      'post_id'    => 'my_theme_options' . getLangSuffix(),  // Define a post_id and append lang suffix
      'page_title' => __('Theme Settings', 'my_text_domain'),
      'menu_title' => __('Theme Settings', 'my_text_domain'),
      'menu_slug' => 'theme-settings',
      'capability' => 'edit_posts',
      'redirect' => false
    ));
  }
 
}

// Get language suffix if not default language
function getLangSuffix(){
  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 '';
}

And to load a field use

get_field( 'my_field', 'my_theme_options' . getLangSuffix() );

I am not sure that this would be a fix. There is also this workaround that is very limited hidden link

Please let me know if this code could fix the issue.

Jamal
WPML Support

December 28, 2018 at 1:28 pm #3040170

guyt-2

Hi Jamal, this code didn't work for me but I have noticed something else that maybe has something to do with all the problems, I will separate it step by step:

1. I thought maybe I will create a new fields group on the translated language without translating it from the default language and see what happens.
2. I clicked "add new" on the fields group on the translated lang, and created some test field and then scrolled down to choose the options page it will be displayed on.
3. Suddenly I saw that the drop-down where I choose the options page remains disabled for a long time and doesn't load all the options pages I can choose.
4. I open the console log on the web browser and saw an error about "admin-ajax" 500.
5. I am guessing that maybe one of the plugins is responsible for the error, so I went to the plugins page and start by disabling the first plugin, which is "acf multilingual".
6. I am going back to the field group I added before, and I see that the drop-down works perfectly.
7. I finished creating my field and going to the options page on the translated lang (which had the problem before) and voila! the field is appearing there.
8. so I think the "acf multilingual" is responsible for some issues, and maybe it is better to check it.
9. THE TERMS LIST SHOWING FINE ALSO!
but off course I could not work without the "acf multilingual" because I have to make everything work as a translation.

December 28, 2018 at 1:57 pm #3040343

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

I will update our compatibility theme about the results of your test.

I also got a hint that this issue is not happening with the community edition of ACF https://wordpress.org/plugins/advanced-custom-fields/
Is there a possibility for you to use this version ? Can you test with it ? Just install/activate it and deactivate the ACF Pro.

Otherwise, i am sorry, there is no planned date yet for an ACFML release that would fix this.

Please let me know if you can use ACF instead of ACF Pro.

Best regards,
Jamal
WPML Support