Skip to content

Instantly share code, notes, and snippets.

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 hawkidoki/5eeda97f2b3c280094f8c2286ba9e992 to your computer and use it in GitHub Desktop.
Save hawkidoki/5eeda97f2b3c280094f8c2286ba9e992 to your computer and use it in GitHub Desktop.
<?php
function hwk_acf_get_group_by_field($field, $post_id = null){
if(!$post_id)
$post_id = get_the_ID();
if(!$post_id)
$post_id = get_queried_object_id();
if( ($field = get_field_object($field, $post_id)) && isset($field['parent']) && ($group = acf_get_field_group($field['parent'])) )
return $group;
return;
}
$group = hwk_acf_get_group_by_field('champs_texte');
$group['hwk_image'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment