Permissions Control

ACF Extended adds a new layer of display control for Field Groups. You can choose which roles can see the Field Group in the “Post Edit” screen. By default none are selected, which means all roles can interact with it.

Note: Keep in mind that once activated, the Field Group Permissions will totally remove the Field Group from the “Post Edit” screen for the unselected roles. That means fields won’t be submitted & processed during submissions actions like acf/save_post or acf/update_value.

Set Settings in PHP

It is possible to set this setting in PHP using the acf/load_field_group hook. Note that this hook is used everywhere, including in ACF admin and tools screen. Which means the setting will be used when exporting the field group.

To avoid that behavior, you can use the acfe_is_admin_screen() function as condition. Usage example:

add_filter('acf/load_field_group', 'my_acf_field_group');
function my_acf_field_group($field_group){
    
    // Bail early if in ACF admin/tool screen
    if(acfe_is_admin_screen())
        return $field_group;
    
    // Target a specific key
    if($field_group['key'] !== 'group_5f20935b9a777')
        return $field_group;
    
    // Settings
    $field_group['acfe_permissions'][] = 'administrator';
    
    // Return
    return $field_group;
    
}

Retrieve Settings

Permissions settings are saved in the Field Group array, under acfe_permissions key. It can be retrieved using acf_get_field_group(). Usage example:

$field_group = acf_get_field_group('group_5f20935b9a777');

/*
 * [instruction_placement] => label
 * [hide_on_screen] =>
 * ...
 * [acfe_permissions] => Array
 * (
 *     [0] => administrator
 *     [1] => editor
 * )
 * ...
 */