This thread is resolved. Here is a description of the problem and solution.
Problem:
The client was experiencing a fatal error when trying to translate a page that uses 'flexible content' blocks from ACF. The error occurred on the backend when switching to the English version of the page, and also when visiting the page on the frontend.
Solution:
We recommended the client to try a workaround from a similar support ticket: https://wpml.org/forums/topic/cloning-flexible-content-fields-into-acf-options-page-causing-php-error/.
If the solution provided is not relevant due to being outdated or not applicable to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please open a new support ticket: Contact WPML Support.
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.
Tagged: Bug
This topic contains 8 replies, has 3 voices.
Last updated by Long Nguyen 1 year, 4 months ago.
Assisted by: Long Nguyen.
Author | Posts |
---|---|
February 16, 2024 at 7:40 am #15310237 | |
justind-19 |
Hello support, I have setup an options to manage content on a project overview page. The content on all the pages is managed with 'flexible content' blocks from ACF. This works fine until you try to translate the page. Link to a page where the issue can be seen: I expected to see: Instead, I got: I found this thread which seems to be the same issue: https://wpml.org/forums/topic/the-spanish-version-of-the-acf-options-page-gives-me-a-fatal-error/ I followed the steps mentioned in this thread. I deleted database records from my options table with options_en_components. This fixes the error, but when i go back to translate the fields the error shows up again. It does not seem to matter which setting i use for translating the group. Stack trace: PHP Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in /data/sites/web/re-borncom/subdomains/staging/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-flexible-content.php:771 Stack trace: #0 /data/sites/web/re-borncom/subdomains/staging/wp-includes/class-wp-hook.php(324): acf_field_flexible_content->load_value(Array, 'options_en', Array) #1 /data/sites/web/re-borncom/subdomains/staging/wp-includes/plugin.php(256): WP_Hook->apply_filters(Array, Array) #2 /data/sites/web/re-borncom/subdomains/staging/wp-content/plugins/advanced-custom-fields-pro/includes/acf-hook-functions.php(109): apply_filters_ref_array('acf/load_value/...', Array) #3 /data/sites/web/re-borncom/subdomains/staging/wp-includes/class-wp-hook.php(324): _acf_apply_hook_variations(Array, 'options_en', Array) #4 /data/sites/web/re-borncom/subdomains/staging/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array) #5 /data/sites/web/re-borncom/subdomains/staging/wp-content/plugins/advanced-custom-fields-pro/includes/acf-value-functions.php(118): apply_filters('acf/load_value', Array, 'options_en', Array) #6 /data/sites/web/re-borncom/subdomains/staging/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php(307): acf_get_value('options_en', Array) #7 /data/sites/web/re-borncom/subdomains/staging/wp-content/plugins/acfml/classes/strategy/repeater-sync/OptionPageHooks.php(42): get_field_objects('options_en') #8 /data/sites/web/re-borncom/subdomains/staging/wp-content/plugins/sitepress-multilingual-cms/classes/action-filter-loader/class-wpml-action-filter-loader.php(158): ACFML\Repeater\Sync\OptionPageHooks->add_hooks() #9 /data/sites/web/re-borncom/subdomains/staging/wp-content/plugins/sitepress-multilingual-cms/classes/action-filter-loader/class-wpml-action-filter-loader.php(125): WPML_Action_Filter_Loader->run_factory(Object(ACFML\Repeater\Sync\HooksFactory)) #10 /data/sites/web/re-borncom/subdomains/staging/wp-includes/class-wp-hook.php(324): WPML_Action_Filter_Loader->deferred_loader('') #11 /data/sites/web/re-borncom/subdomains/staging/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #12 /data/sites/web/re-borncom/subdomains/staging/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #13 /data/sites/web/re-borncom/subdomains/staging/wp-settings.php(665): do_action('wp_loaded') #14 /data/sites/web/re-borncom/subdomains/staging/wp-config.php(100): require_once('/data/sites/web...') #15 /data/sites/web/re-borncom/subdomains/staging/wp-load.php(50): require_once('/data/sites/web...') #16 /data/sites/web/re-borncom/subdomains/staging/wp-admin/admin.php(34): require_once('/data/sites/web...') #17 /data/sites/web/re-borncom/subdomains/staging/wp-admin/edit.php(10): require_once('/data/sites/web...') #18 {main} thrown in /data/sites/web/re-borncom/subdomains/staging/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-flexible-content.php on line 771 |
February 16, 2024 at 11:10 am #15311224 | |
Nicolas V. Supporter
Languages: English (English ) French (Français ) Timezone: America/Lima (GMT-05:00) |
Hi, Welcome to the WPML support forum. Thanks for contacting us. We are currently handling a high amount of ticket and while waiting for one of my colleagues to help with this ticket, please allow me to walk you through some initial documentation. 1. https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/ 2. https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/recommended-custom-fields-translation-preferences-for-acf-and-wpml/ Nico |
February 16, 2024 at 11:49 am #15311332 | |
justind-19 |
Hi Nicolas, Thank you for your quick response. I already set the field group multilangual setup as "Same fields across languages". During debugging I also tested the other options, but this made no difference. For my usecase the "Same fields across languages" would suffice. Kind regards, |
February 19, 2024 at 3:40 am #15315833 | |
Long Nguyen WPML Supporter since 02/2022
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi Justin, Thank you for contacting WPML support, I'd be happy to help you with this issue. Please try the workaround in this ticket https://wpml.org/forums/topic/cloning-flexible-content-fields-into-acf-options-page-causing-php-error/ Also, I see that the WordPress Memory Limit is below the requirements. The minimum requirements are 128M, but we do recommend 256M and the debug information of your site shows it set to 40M. Please check this link for more details define( 'WP_MAX_MEMORY_LIMIT', '256M' ); define( 'WP_MEMORY_LIMIT', '128M' ); After adding the code you can confirm that the memory was changed correctly from WPML > Support > WordPress > Memory limit. Look forward to your reply. |
February 19, 2024 at 8:12 am #15316274 | |
justind-19 |
Hi Long, Thanks for your response! I tried the workaround as you mentioned and it does prevent the error from occuring so that is a good thing! But now when I try to translate my settings page content by switching to the english page, editing the fields an pressing save. It does not do anything. The changes get reverted and I see my original language content. Also I read that in the original thread the problem occurs because a flexible content field is cloned on a settings page. In my case i have a field group with a flexible content field that i use on multiple pages, so i set the display conditions to the specific options page. I am not using the clone field here. I also updated my memory limit. Is there anything else i can try to get my content translated? Kind regards, New threads created by Long Nguyen and linked to this one are listed below: |
February 19, 2024 at 9:28 am #15316755 | |
Long Nguyen WPML Supporter since 02/2022
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to have a testing site where the issue is replicated. Your next reply is set to private to share the info. ❌ IMPORTANT: Please backup your database and website before proceeding ❌ Look forward to your reply. |
February 21, 2024 at 2:38 am #15325149 | |
Long Nguyen WPML Supporter since 02/2022
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, After restoring your site on my localhost, I can see the issue. It is a different issue so I will split it into a new ticket for better handling. Here is the URL https://wpml.org/forums/topic/the-changes-on-the-options-page-get-reverted-and-i-see-my-original-language-content/ If you see the main issue of this ticket with an error when saving options page is resolved, please mark it as Resolved. Thanks. |
February 21, 2024 at 8:14 am #15325713 | |
justind-19 |
Hi Long, Thanks for the help! This issue is indeed solved. However I have still one question. I now edited the plugin source files with this fix. This is something I'd rather not do. When I update the plugin this change will be gone. Is this patch coming in a future release of the plugin? Or is there any other way I can patch this bug from my custom theme or using a custom plugin? Thanks! |
February 21, 2024 at 9:31 am #15326334 | |
Long Nguyen WPML Supporter since 02/2022
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, I'm afraid that there isn't a way to use the workaround in a custom theme or plugin. Thanks for your patience. |
February 21, 2024 at 9:35 am #15326350 | |
justind-19 |
Alright, thats what we will have to do then. Hope it will be fixed soon. Thanks for the help! |