From b64d5fb0e3e5200a66324bd9db9f50b320917663 Mon Sep 17 00:00:00 2001 From: Adrian Tobey Date: Thu, 2 Jan 2025 10:52:44 -0500 Subject: [PATCH] fix notice --- includes/form/form-v2.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/includes/form/form-v2.php b/includes/form/form-v2.php index 0bb355d55..2ce8b6a68 100644 --- a/includes/form/form-v2.php +++ b/includes/form/form-v2.php @@ -203,10 +203,17 @@ function standard_dropdown_callback( $field, $posted_data, &$data, &$meta, &$tag * @return void */ function standard_multiselect_callback( $field, $posted_data, &$data, &$meta, &$tags ) { - $selections = map_deep( $posted_data[ $field['name'] ], 'sanitize_text_field' ); - $meta[ $field['name'] ] = $selections; - $options = $field['options']; + $selections = get_array_var( $posted_data, $field['name'], [] ); + + if ( ! is_array( $selections ) ) { + return; + } + + $selections = map_deep( array_filter( $selections ), 'sanitize_text_field' ); + + $meta[ $field['name'] ] = $selections; + $options = $field['options']; // Find associated tags and apply foreach ( $selections as $selection ) {