Use this :
if( function_exists(‘acf_add_local_field_group’) ):
acf_add_local_field_group(array(
‘key’ => ‘group_5f33968e2461e’,
‘title’ => ‘Champs Articles’,
‘fields’ => array(
array(
‘key’ => ‘field_5f33969714b2f’,
‘label’ => ‘Gestion des droits’,
‘name’ => ‘manage-role’,
‘type’ => ‘checkbox’,
‘instructions’ => ”,
‘required’ => 0,
‘conditional_logic’ => 0,
‘wrapper’ => array(
‘width’ => ”,
‘class’ => ”,
‘id’ => ”,
),
‘choices’ => get_roles(),
‘allow_custom’ => 0,
‘default_value’ => false,
‘layout’ => ‘vertical’,
‘toggle’ => 0,
‘return_format’ => ‘value’,
‘save_custom’ => 0,
),
),
‘location’ => array(
array(
array(
‘param’ => ‘post_type’,
‘operator’ => ‘==’,
‘value’ => ‘post’,
),
),
),
‘menu_order’ => 0,
‘position’ => ‘side’,
‘style’ => ‘default’,
‘label_placement’ => ‘left’,
‘instruction_placement’ => ‘label’,
‘hide_on_screen’ => ”,
‘active’ => true,
‘description’ => ”,
));
endif;
function get_roles() {
$wp_roles = new WP_Roles();
$roles = $wp_roles->get_names();
return $roles;
}