Skip to content

Commit

Permalink
fixed sanitize_selector function for multiple and callback selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
Fellan-91 committed May 11, 2024
1 parent 8b8a342 commit 8e5f015
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion classes/class-security.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] ?? '';
}

Expand Down

0 comments on commit 8e5f015

Please sign in to comment.