Skip to content Skip to sidebar

Open

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;
    }
    

6 Responses to “ACF - Clone Field Set to Copy Once Does Not Retrieve Values in Original Language”

  1. When is this going to be implemented?
    I am having terrible issues with this, and i can’t keep manually patching the class after each update in every website

    • Hi Eytan,

      I can see that Itamar has already escalated your feedback to the development team. He’ll keep you updated in the support ticket.

  2. 6 months have passed and this solution has not yet been implemented!
    I have to manually change it and be careful not to update the plugin locally.

    This is a BUG on your part and the solution YOU suggested must be implemented in the code.

    • Hi Eytan,

      Thanks for reaching out. This issue is on our development roadmap, and we’ll update the errata once a fix is implemented. We appreciate your patience in the meantime.

  3. That is the reply i got months ago. The solution is adding a single line to the code. A line that your developers suggested and I can assure is working.
    Please make this happen, it really should not take months.

    • Hi Eytan,

      There hasn’t been any new version of ACFML since the issue was reported, so the workaround only needs to be applied once.

      I’ve forwarded your feedback to the internal report so the devs can prioritize it and evaluate the fix for the next release. We don’t have an ETA at the moment.

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>