Title: error: expects array, string given
Last modified: May 2, 2020

---

# error: expects array, string given

 *  [Craig Hordlow](https://wordpress.org/support/users/chordlow/)
 * (@chordlow)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/error-expects-array-string-given/)
 * I’m getting this message:
 * Warning: in_array() expects parameter 2 to be array, string given in /home4/slap1fe8/
   public_html/wp-content/plugins/wp-user-frontend-pro/includes/content-restriction.
   php on line 302
 * This is the code before/after (I added “Line 302” to indicate)
 *  if ( ‘loggedin’ == $type ) {
    $current_user_info = get_userdata( get_current_user_id());
   $current_user_roles = $current_user_info->roles;
 *  foreach ($current_user_roles as $role) {
    LINE 302 if ( in_array( $role, $allowed_roles)){
   $user_exist = true; break; }else{ $user_exist = false; } }

Viewing 1 replies (of 1 total)

 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/error-expects-array-string-given/#post-12770440)
 * You should ask in the plugin’s support forum.

Viewing 1 replies (of 1 total)

The topic ‘error: expects array, string given’ is closed to new replies.

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [error message](https://wordpress.org/support/topic-tag/error-message/)
 * [string](https://wordpress.org/support/topic-tag/string/)
 * [wp user frontend pro](https://wordpress.org/support/topic-tag/wp-user-frontend-pro/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Joy](https://wordpress.org/support/users/joyously/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/error-expects-array-string-given/#post-12770440)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
