How get fields from specific post and specific group?
I have this code:
// Get field from another post
$source_fields = get_fields($another_post_id );
// Update fields in this post
foreach ($source_fields as $field_name => $field_value) {
update_field($field_name, $field_value, $post_id);
– i have many groups fields and in this case i need to use only specific group – group_6457959205b1b (ID 4985)
in case anyone out there, here’s what worked
// Get field from another post
$fields = acf_get_fields('group_6457959205b1b');
// Update fields in this post
foreach ($fields as $field) {
$field_name = $field['name'];
$field_value = get_field($field_name, $another_post_id);
update_field($field_name, $field_value, $post_id);
}