Skip to content

Commit

Permalink
Widget Visibility: avoid PHP warnings when loading widgets. (#24460)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeherve authored May 23, 2022
1 parent 8d4703b commit fd6d18a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: bugfix

Widget Visibility: avoid PHP warnings when loading widgets in some scenarios.
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,10 @@ public static function migrate_post_type_rules() {
$opts = $wp_registered_widgets[ $widget ];
$instances = get_option( $opts['callback'][0]->option_name );

if ( ! is_array( $instances ) || empty( $instances ) ) {
continue;
}

// Going through each instance of the widget.
foreach ( $instances as $number => $instance ) {
if (
Expand Down

0 comments on commit fd6d18a

Please sign in to comment.