Fix broken db update button on homescreen (#47608)
* Add handling of return url * Use base admin URL and redirect to current page * Update plugins/woocommerce/includes/admin/notes/class-wc-notes-run-db-update.php Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> * Update plugins/woocommerce/includes/class-wc-install.php Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> * Changelog --------- Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
This commit is contained in:
parent
544c843b67
commit
da57287c56
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Fix broken db update button on homescreen
|
|
@ -113,8 +113,9 @@ class WC_Notes_Run_Db_Update {
|
|||
add_query_arg(
|
||||
array(
|
||||
'do_update_woocommerce' => 'true',
|
||||
'return_url' => wc_get_current_admin_url() ? wc_get_current_admin_url() : admin_url( 'admin.php?page=wc-settings' ),
|
||||
),
|
||||
wc_get_current_admin_url() ? wc_get_current_admin_url() : admin_url( 'admin.php?page=wc-settings' )
|
||||
admin_url()
|
||||
);
|
||||
|
||||
$note_actions = array(
|
||||
|
|
|
@ -424,6 +424,10 @@ class WC_Install {
|
|||
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.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue