Skip to content

Commit

Permalink
preserve NULL for "show_widget_roles" option, if unset (#274)
Browse files Browse the repository at this point in the history
Initializing an empty array results in nobody able to see the widget.
This breaks behavior on legacy sites when the reduced option set is
saved from the back-view of the widget.
  • Loading branch information
stklcode committed Oct 18, 2023
1 parent 83a29f1 commit 600f95e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions inc/class-statify-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,7 @@ public static function sanitize_options( $options ) {
}
}

// Sanitize user roles.
$res['show_widget_roles'] = array();
// Sanitize user roles (preserve NULL, if unset).
if ( isset( $options['show_widget_roles'] ) ) {
$available_roles = apply_filters( 'statify__available_roles', wp_roles()->roles );
foreach ( $options['show_widget_roles'] as $saved_role ) {
Expand Down

0 comments on commit 600f95e

Please sign in to comment.