Skip to content

Instantly share code, notes, and snippets.

@iamntz
Created May 7, 2016 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamntz/29f9d1540befbd772c71e23014893139 to your computer and use it in GitHub Desktop.
Save iamntz/29f9d1540befbd772c71e23014893139 to your computer and use it in GitHub Desktop.
<?php
add_action('wpml_updated_translation_status', function ($data) {
$postid = $data['translation_id'];
$groups = acf_get_field_groups();
foreach ($groups as $group) {
$fields = acf_get_fields($group);
foreach ($fields as $field) {
if ($field['type'] == 'gallery') {
$fieldValues = get_field($field['name'], $postid, false);
foreach ($fieldValues as $fieldValues) {
$translatedID = icl_object_id($fieldValues, 'attachment', false, ICL_LANGUAGE_CODE);
//do something with this `$translatedID`
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment