Don't run setup wizard redirects from AS.

This commit is contained in:
Peter Fabian 2020-02-07 00:20:42 +01:00
parent e9b6faa8df
commit 06d0bbefc4
2 changed files with 14 additions and 0 deletions

View File

@ -127,6 +127,10 @@ class WC_Admin {
* For setup wizard, transient must be present, the user must have access rights, and we must ignore the network/bulk plugin updaters.
*/
public function admin_redirects() {
if ( wc_is_running_from_async_action_scheduler() ) {
return;
}
// phpcs:disable WordPress.Security.NonceVerification.Recommended
// Nonced plugin install redirects (whitelisted).
if ( ! empty( $_GET['wc-install-plugin-redirect'] ) ) {

View File

@ -2273,3 +2273,13 @@ function wc_load_cart() {
WC()->initialize_session();
WC()->initialize_cart();
}
/**
* Test whether the context of execution comes from async action scheduler.
*
* @since 4.0.0
* @return bool
*/
function wc_is_running_from_async_action_scheduler() {
return isset( $_REQUEST['action'] ) && 'as_async_request_queue_runner' === $_REQUEST['action'];
}