Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion mu-plugin/plausible-proxy-speed-module.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Comment thread
Dan0sz marked this conversation as resolved.

$expected = function_exists( 'rest_url' )
? untrailingslashit( (string) wp_parse_url( rest_url( trim( $namespace, '/' ) ), PHP_URL_PATH ) )
: '/wp-json/' . trim( $namespace, '/' );
Expand Down
Loading