Home › Forums › ACF PRO › Empty Array on 'acf/get_field_groups' › Reply To: Empty Array on 'acf/get_field_groups'
Hi drs-nyc and elliot upon facing this problem I did come up some solution. Some one in the forum did suggest to use post.
Here’s the code:
function is_field_group_exists($value, $type='post_title') {
$exists = false;
if ($field_groups = get_posts(array('post_type'=>'acf-field-group'))) {
foreach ($field_groups as $field_group) {
if ($field_group->$type == $value) {
$exists = true;
}
}
}
return $exists;
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.