Fix warning on WC Pay subscriptions page with unset submenu item (#33339)

* Fix warning on WC Pay subscriptions page with unset submenu item

* Add isset check before iterating over submenu in task list
This commit is contained in:
jonathansadowski 2022-06-07 12:50:34 -05:00 committed by GitHub
parent 77703fd7f2
commit eba6df8299
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix a warning caused by an attempt to iterate over a submenu that may not exist on WC Pay subscriptions page.

View File

@ -499,7 +499,7 @@ class TaskLists {
$tasks_count = self::setup_tasks_remaining();
if ( ! $tasks_count ) {
if ( ! $tasks_count || ! isset( $submenu['woocommerce'] ) ) {
return;
}

View File

@ -231,6 +231,9 @@ class WcPaySubscriptionsPage {
$wc_admin_menu = array();
$subscriptions_menu_item = null;
if ( ! isset( $submenu['woocommerce'] ) ) {
return;
}
foreach ( $submenu['woocommerce'] as $key => $menu_item ) {
$wc_admin_menu[ $key ] = $menu_item;