Overview of the Issue
When translating pages that include an Advanced Custom Fields (ACF) Gallery block with radio button selections, these radio choices are unexpectedly appearing in the Advanced Translation Editor (ATE).
Workaround
This issue is fixed in ACFML 5.0.0. Updating solves it on your site, so you only need this workaround if you can’t update yet.
Update to ACFML 5.0 or later, then set the radio fields to Copy in their field group. Only real text then goes to automatic translation.
If you cannot update yet:
Please, make sure of having a full site backup of your site before proceeding.- Open your theme’s functions.php file.
- Add the following code:
// WPML Workaround for compsupp-7404 add_filter( 'wpml_found_strings_in_block', function( array $strings, WP_Block_Parser_Block $block ) { $isInBlacklistedStrings = function( string $fieldName ) { // Add the fields to ignore here $fieldsToIgnore = []; $fieldsToIgnore[] = 'gallery_section_type'; $fieldsToIgnore[] = 'gallery_section_variant'; if ( in_array($fieldName, $fieldsToIgnore) ) { return true; } return false; }; if ( $block->blockName == 'acf/gallery' ) { foreach( $block->attrs['data'] as $fieldName => $string ) { if ( $isInBlacklistedStrings( $fieldName ) ) { unset( $block->attrs['data'][ $fieldName ] ); } } } return $strings; }, 9, 2 ); // Lower priority than 10.
Still Seeing This Issue?
If updating doesn’t fix it, ask a support question and we’ll look into it with you.
Ask a support question