Support

Account

Home Forums General Issues How to check if field group exists in ACF5/Pro Reply To: How to check if field group exists in ACF5/Pro

  • Thanks Daron it did give me an idea.

    Here what I come up with the idea.

    
    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;
        }

    Anyone can use the function for checking if field group exist.