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 183Line 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!
-PaulMightyhttps://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.