Title: in_array() expects parameter 2 to be array
Last modified: August 21, 2016

---

# in_array() expects parameter 2 to be array

 *  Resolved [Kunal](https://wordpress.org/support/users/kunalnagar/)
 * (@kunalnagar)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/in_array-expects-parameter-2-to-be-array-1/)
 * After creating a custom field as a User Role Selector and attaching it to a Custom
   Post Type, I get the following error before all of the User Roles:
 * Warning: in_array() expects parameter 2 to be array, boolean given in wp-content\
   plugins\acf-role-selector-field\role_selector-v4.php on line 165
 * [https://wordpress.org/plugins/acf-role-selector-field/](https://wordpress.org/plugins/acf-role-selector-field/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [mike82gr](https://wordpress.org/support/users/mike82gr/)
 * (@mike82gr)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/in_array-expects-parameter-2-to-be-array-1/#post-5044362)
 * Just change line 165 to this:
    `$checked = ( is_array($selected_roles) && in_array(
   $role, $selected_roles ) ) ? 'checked="checked"' : '';`
 *  Thread Starter [Kunal](https://wordpress.org/support/users/kunalnagar/)
 * (@kunalnagar)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/in_array-expects-parameter-2-to-be-array-1/#post-5044363)
 * Yes I figured that out eventually. Thanks though!
 *  Plugin Author [danielpataki](https://wordpress.org/support/users/danielpataki/)
 * (@danielpataki)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/in_array-expects-parameter-2-to-be-array-1/#post-5044386)
 * Sorry about the lateness, I wasn’t getting notifications! I think this has now
   been resolved, if this is still an issue let me know!
 * Daniel
 *  [DavidMS83](https://wordpress.org/support/users/davidms83/)
 * (@davidms83)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/in_array-expects-parameter-2-to-be-array-1/#post-5044395)
 * Hi, has anyone been able to make this plug in work? I mean, I change the role
   from the field I’ve created but the role doesn’t change… If anyone could help
   me please…
    Thankx

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘in_array() expects parameter 2 to be array’ is closed to new replies.

 * ![](https://ps.w.org/acf-role-selector-field/assets/icon-256x256.png?rev=1140412)
 * [ACF: User Role Selector](https://wordpress.org/plugins/acf-role-selector-field/)
 * [Support Threads](https://wordpress.org/support/plugin/acf-role-selector-field/)
 * [Active Topics](https://wordpress.org/support/plugin/acf-role-selector-field/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/acf-role-selector-field/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/acf-role-selector-field/reviews/)

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [in_array](https://wordpress.org/support/topic-tag/in_array/)
 * [parameter 2](https://wordpress.org/support/topic-tag/parameter-2/)

 * 4 replies
 * 4 participants
 * Last reply from: [DavidMS83](https://wordpress.org/support/users/davidms83/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/in_array-expects-parameter-2-to-be-array-1/#post-5044395)
 * Status: resolved