function roles_select( $field ) { $data = array(''); $roles_obj = new WP_Roles(); $roles_names_array = $roles_obj->get_names(); if (!empty($roles_names_array)) { foreach($roles_names_array as $role_slug => $roles) { $data[$role_slug] = $role_slug; } } $field['choices'] = $data; return $field; } add_filter('acf/load_field/name=roles_select', 'roles_select');