I created a field group for a specific page, which is working great. But in the event that I want to deactivate it, I see there is an option in Custom Fields -> Field Group -> Settings
, called Active
. When I click that to be No
, how can make that process hide my field group from being displayed on the front-end page?
What would be a good coding process?
Might be missing something, but surely just an if statement would do the job?
if(get_field('active')) {
// do something
}
ACF does not check a field group to see if it’s active when you use get_field() and other field functions. You would need to check this yourself by getting the field group
$group = acf_get_field_group('group_5c1d039ed4066'); // your field group key
if ($group['active']) {
// code here for showing fields in the group
}