Title: in_array() PHP error breaking admin select
Last modified: August 21, 2016

---

# in_array() PHP error breaking admin select

 *  [PaulMighty](https://wordpress.org/support/users/paulmighty/)
 * (@paulmighty)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/in_array-php-error-breaking-admin-select/)
 * Ran into an issue with the select dropdown breaking when editing a page with 
   a single gallery select configuration. Multi gallery select worked, just an issue
   with single gallery select set in the field group. An array is required when 
   in_array is invoked to check if the current item in the loop matches a selected
   item, resulting in a broken select dropdown and this warning:
 *     ```
       Warning:  in_array() expects parameter 2 to be array, string given in website.com/wp-content/plugins/advanced-custom-fields-nextgen-gallery-custom-field/nggallery-v4.php on line 183
       ```
   
 * Line number 183 might not be exact due to my testing, but below is what I ended
   up with that fixes the issue. In a nutshell, things only work out if $aSelectedGalleries
   is an array and not a string.
 *     ```
       // Get selected galleries
       $aSelectedGalleries = is_array( $field['value'] ) ? $field['value'] : array( $field['value'] );
       ```
   
 * Cheers and thanks for the great plugin!
    -PaulMighty
 * [https://wordpress.org/plugins/advanced-custom-fields-nextgen-gallery-field-add-on/](https://wordpress.org/plugins/advanced-custom-fields-nextgen-gallery-field-add-on/)

The topic ‘in_array() PHP error breaking admin select’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/advanced-custom-fields-nextgen-gallery-
   field-add-on_fcfcfd.svg)
 * [Advanced Custom Fields: NextGEN Gallery Field add-on](https://wordpress.org/plugins/advanced-custom-fields-nextgen-gallery-field-add-on/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-custom-fields-nextgen-gallery-field-add-on/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-custom-fields-nextgen-gallery-field-add-on/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-custom-fields-nextgen-gallery-field-add-on/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-custom-fields-nextgen-gallery-field-add-on/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-custom-fields-nextgen-gallery-field-add-on/reviews/)

## Tags

 * [ACF](https://wordpress.org/support/topic-tag/acf/)
 * [in_array](https://wordpress.org/support/topic-tag/in_array/)
 * [nextgen](https://wordpress.org/support/topic-tag/nextgen/)

 * 0 replies
 * 1 participant
 * Last reply from: [PaulMighty](https://wordpress.org/support/users/paulmighty/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/in_array-php-error-breaking-admin-select/)
 * Status: not resolved