shouldRedirect() ) { return; } delete_option( self::FLAG_OPTION ); wp_safe_redirect( admin_url( 'admin.php?page=' . self::ONBOARDING_PAGE_SLUG ) ); exit; } public function shouldRedirect(): bool { if ( ! get_option( self::FLAG_OPTION ) ) { return false; } if ( wp_doing_ajax() ) { return false; } if ( ! current_user_can( 'manage_woocommerce' ) ) { return false; } // Don't hijack bulk-activation (activating several plugins at once). // Presence-only check, no value read — nothing to sanitize, and this // doesn't process form data, so no nonce applies. if ( isset( $_GET['activate-multi'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended return false; } return true; } }