Created
May 7, 2016 19:46
-
-
Save iamntz/29f9d1540befbd772c71e23014893139 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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