From 27f5a206e1096c1cf546cfd9f9d572aec70517ce Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Thu, 28 May 2026 16:30:10 +0200 Subject: [PATCH] Fixed: speed module would cause fatal errors in wp-admin on multisite networks. --- mu-plugin/plausible-proxy-speed-module.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mu-plugin/plausible-proxy-speed-module.php b/mu-plugin/plausible-proxy-speed-module.php index 41d59f1..32c6bd1 100644 --- a/mu-plugin/plausible-proxy-speed-module.php +++ b/mu-plugin/plausible-proxy-speed-module.php @@ -4,7 +4,7 @@ * Description: Speeds up Plausible Analytics' proxy for avoiding ad blockers. * Plugin URI: https://plausible.io * Author: Plausible HQ - * Version: 1.0.1 + * Version: 1.0.2 * Author URI: https://plausible.io * * Text Domain: plausible-analytics @@ -68,6 +68,17 @@ private function is_proxy_request() { return false; } + /** + * @see rest_url() requires $wp_rewrite to be set. If it's not set yet, just assume this isn't a proxy request. + * + * @since v1.0.2 + */ + global $wp_rewrite; + + if ( $wp_rewrite === null ) { + return false; + } + $expected = function_exists( 'rest_url' ) ? untrailingslashit( (string) wp_parse_url( rest_url( trim( $namespace, '/' ) ), PHP_URL_PATH ) ) : '/wp-json/' . trim( $namespace, '/' );