Skip to content

Fixed: speed module would cause fatal errors in wp-admin on multisite networks.#306

Merged
Dan0sz merged 1 commit into
developfrom
fix_speed_module_multisite
May 30, 2026
Merged

Fixed: speed module would cause fatal errors in wp-admin on multisite networks.#306
Dan0sz merged 1 commit into
developfrom
fix_speed_module_multisite

Conversation

@Dan0sz
Copy link
Copy Markdown
Collaborator

@Dan0sz Dan0sz commented May 28, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Improved proxy request detection to gracefully handle cases where WordPress rewrite rules aren't initialized, preventing potential errors during early WordPress initialization phases.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

📝 Walkthrough

Walkthrough

Plugin version bumped to 1.0.2. The is_proxy_request() function now checks whether the global $wp_rewrite object is initialized, returning false early if it is null, before attempting to compute the expected REST URL path.

Changes

Proxy Request Detection Hardening

Layer / File(s) Summary
Plugin version and proxy detection guard
mu-plugin/plausible-proxy-speed-module.php
Version updated to 1.0.2. Added null check for $wp_rewrite global in is_proxy_request() to safely handle cases where WordPress rewrite rules are not yet initialized, with early return and updated docblock.

Possibly Related PRs

  • plausible/wordpress#297: Both PRs modify the proxy detection logic in mu-plugin/plausible-proxy-speed-module.php's is_proxy_request() function to harden rewrite rule handling.

Poem

🐰 A guard clause hops in place,
Where $wp_rewrite shows its face—
Null check stops the fatal fall,
Version bumps through it all.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions fixing fatal errors on multisite networks, but the actual change is a version bump and a proxy-request detection fix to handle uninitialized rewrite rules—not specifically a multisite-specific fix. Revise the title to accurately reflect the core change: something like 'Fixed: proxy-request detection when WordPress rewrite rules are not initialized' would better represent the actual technical change.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix_speed_module_multisite

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@mu-plugin/plausible-proxy-speed-module.php`:
- Around line 71-80: The current guard and docblock overstate rest_url()'s
dependency on $wp_rewrite and can cause false negatives; update the comment to
note that $wp_rewrite is only needed in specific multisite/permalink cases (via
get_rest_url()/rest_url()), and change the early-return to only bail when
$wp_rewrite is null AND one of those conditions applies (e.g., is_multisite() or
a non-empty get_option('permalink_structure')); reference get_rest_url(),
rest_url(), and the global $wp_rewrite in the updated comment and change the if
to: if ( $wp_rewrite === null && ( is_multisite() ||
get_option('permalink_structure') ) ) return false;
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 52a8a81a-dc9a-4c97-989f-92c1fad1b3f8

📥 Commits

Reviewing files that changed from the base of the PR and between c2fc480 and 27f5a20.

📒 Files selected for processing (1)
  • mu-plugin/plausible-proxy-speed-module.php

Comment thread mu-plugin/plausible-proxy-speed-module.php
@Dan0sz Dan0sz merged commit 7c2bce1 into develop May 30, 2026
7 checks passed
@Dan0sz Dan0sz deleted the fix_speed_module_multisite branch May 30, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant