WPML
Status
Open
Related plugin/theme
Advanced Custom Fields
Topic tags
Compatibility

Overview of the issue

When using ACF – Advanced Custom Fields with the ACFML plugin, if a Clone field is set to Copy Once, the field values cannot be retrieved in the original language on the front end. The issue occurs when the field group containing the Clone field is set to Different fields across languages or when the field is manually set to Copy Once in Expert mode.

Workaround

Please, make sure of having a full site backup of your site before proceeding.


  • Open the …wp-content/plugins/acfml/classes/class-wpml-acf-custom-fields-sync.php file.

  • Look for line 42.

  • Replace:
    public function clean_empty_values_for_copy_once_field( $value, $post_id, $field ) {
    	if ( '' === $value
    		&& ! $this->value_has_been_emptied( $field )
    		&& isset( $field['wpml_cf_preferences'] )
    		&& WPML_COPY_ONCE_CUSTOM_FIELD === $field['wpml_cf_preferences']
    		&& ! $this->isFieldType( $field, 'group' )
    	) {
    		$value = null;
    	}
    	return $value;
    }

  • With:
    // WPML Workaround for compsupp-7767
    public function clean_empty_values_for_copy_once_field( $value, $post_id, $field ) {
    	if ( '' === $value
    		&& ! $this->value_has_been_emptied( $field )
    		&& isset( $field['wpml_cf_preferences'] )
    		&& WPML_COPY_ONCE_CUSTOM_FIELD === $field['wpml_cf_preferences']
    		&& ! $this->isFieldType( $field, 'group' )
    		&& ! $this->isFieldType( $field, 'clone' )
    	) {
    		$value = null;
    	}
    	return $value;
    }

All known issues →