This thread is resolved. Here is a description of the problem and solution.
Problem:
If you're experiencing a critical error message when trying to save widgets in your WordPress using the ACFML plugin, it might be due to a specific widget passing an ACF field with multiple rows, which our code does not handle correctly as it expects string values only.
Solution:
We recommend modifying the method in
wp-content/plugins/acfml/classes/class-wpml-acf-blocks.php
within
WPML_ACF_Blocks::add_block_data_attribute_strings
. Here's the updated method you should use:
public function add_block_data_attribute_strings( array $strings, WP_Block_Parser_Block $block ) {<br />if ( $this->is_acf_block( $block ) && isset( $block->attrs['data'] ) ) {<br />if ( ! is_array( $block->attrs['data'] ) ) {<br />$block->attrs['data'] = array( $block->attrs['data'] );<br />}<br />foreach ( $block->attrs['data'] as $field_name => $text ) {<br />if ( $this->must_skip( $field_name, $text ) ) {<br />continue;<br />}<br />$type = $this->get_text_type( $text );<br />if ( 'array' === $type ) {<br />foreach ( $text as $inner_field_name => $inner_text ) {<br />$inner_type = $this->get_text_type( $inner_text );<br />if ( 'array' === $inner_type ) {<br />foreach ( $inner_text as $inner_field_name_2nd => $inner_text_2nd ) {<br />$inner_type2 = $this->get_text_type( $inner_text_2nd );<br />if ( 'array' === $inner_type2 ) {<br />foreach ( $inner_text_2nd as $inner_field_name_3rd => $inner_text_3rd ) {<br />$inner_type3 = $this->get_text_type( $inner_text_3rd );<br />$strings[] = $this->add_string( $block, $inner_text_3rd, $field_name . '/' . $inner_field_name_3rd, $inner_type3 );<br />}<br />}<br />}<br />} else {<br />$strings[] = $this->add_string( $block, $inner_text, $field_name . '/' . $inner_field_name, $inner_type );<br />}<br />}<br />}<br />else {<br />$strings[] = $this->add_string( $block, $text, $field_name, $type );<br />}<br />}<br />}<br />return $strings;<br />}
Please implement this solution on your website after backing it up. If this solution does not resolve your issue or seems irrelevant due to updates or different circumstances, 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 further assistance is needed, please open a new support ticket at WPML support forum.
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 topic contains 0 replies, has 0 voices.
Last updated by 1 month, 1 week ago.
Assisted by: Lucas Vidal de Andrade.