diff --git a/plugins/woocommerce/changelog/48163-fix-db-update-redirect-issue b/plugins/woocommerce/changelog/48163-fix-db-update-redirect-issue new file mode 100644 index 00000000000..20b4a6beba8 --- /dev/null +++ b/plugins/woocommerce/changelog/48163-fix-db-update-redirect-issue @@ -0,0 +1,4 @@ +Significance: minor +Type: fix + +Fix db update notice redirection bug where it redirects without checking for db update action.
Changelog Entry Comment \ No newline at end of file diff --git a/plugins/woocommerce/includes/class-wc-install.php b/plugins/woocommerce/includes/class-wc-install.php index 2dde45c543f..0f703584eec 100644 --- a/plugins/woocommerce/includes/class-wc-install.php +++ b/plugins/woocommerce/includes/class-wc-install.php @@ -423,10 +423,11 @@ class WC_Install { check_admin_referer( 'wc_db_update', 'wc_db_update_nonce' ); self::update(); WC_Admin_Notices::add_notice( 'update', true ); - } - if ( ! empty( $_GET['return_url'] ) ) { // WPCS: input var ok. - $return_url = esc_url_raw( wp_unslash( $_GET['return_url'] ) ); - wp_safe_redirect( $return_url ); // WPCS: input var ok. + + if ( ! empty( $_GET['return_url'] ) ) { // WPCS: input var ok. + $return_url = esc_url_raw( wp_unslash( $_GET['return_url'] ) ); + wp_safe_redirect( $return_url ); // WPCS: input var ok. + } } }