From 8e5f0151cbff595827cb5adc8defe64808f943cd Mon Sep 17 00:00:00 2001 From: Fellan-91 Date: Sat, 11 May 2024 13:05:13 +0300 Subject: [PATCH] fixed sanitize_selector function for multiple and callback selectors --- classes/class-security.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/classes/class-security.php b/classes/class-security.php index b0290714..f45b093e 100644 --- a/classes/class-security.php +++ b/classes/class-security.php @@ -218,8 +218,14 @@ public static function sanitize_boolean( $attribute ) { public static function sanitize_selector( $attribute, $control ) { /** * Checking a selector for invalid options. + * Exclude multiple and dynamically callback selectors. */ - if ( ! array_key_exists( $attribute, $control['options'] ) ) { + if ( + empty( $control['value_callback'] ) && + ! empty( $control['options'] ) && + ! $control['multiple'] && + ! array_key_exists( $attribute, $control['options'] ) + ) { $attribute = $control['default'] ?? ''; }