You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: read options from the same store they are saved to on multisite - #149
On multisite, when the plugin is not network-activated, settings were saved to the per-site wp_N_options table but always read with get_site_option(), which returns the network-level value. Sub-sites therefore saved their settings, never saw them again, and fell back to defaults (or to the primary site's values once it was configured).
includes/Options.php: get_options() now reads from the same store update_options() writes to: network option when network-activated, per-site option otherwise.
The static options cache is keyed by blog ID, so switch_to_blog() cannot return another site's cached settings.
readme.txt: changelog entry.
Verification
Ran the real Options class against a local multisite (plugin not network-active), saving timer=17 on blog 4 and then forcing a fresh read:
Before: re-read returned 5 (reproduces the report).
After: re-read returned 17; blogs 5 and 1 stayed at the default 5.
composer lint (PHPCS/PHPStan) and npm run lint pass with no errors.
Not run: the PHPUnit suite (needs a disposable _test database) and browser testing. The existing multisite test bootstrap network-activates the plugin, so it exercises only the network path; no new test added.
Fixed an issue where subsites that aren’t network-activated could show default settings instead of their own saved settings. Multisite settings now display and apply consistently with the values saved for each site. This helps ensure configuration changes are reflected correctly across multisite installations.
No actionable comments were generated in the recent review.
Walkthrough
The options getter now invalidates cached options when the current blog changes. It reads from site options on multisite and regular options otherwise. The Unreleased changelog records the multisite settings fix.
The getter clears cached options when the blog ID changes and selects the option store based on multisite status. The changelog notes that non-network-activated subsites use and display their own settings.
Site and network activations use matching settings stores. No merge-blocking issue was established.
Pre-merge checks: 5
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly describes the main change: reading multisite options from the same store used to save them.
Docstring Coverage
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files. (1 skipped: 1 unsupported.)
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Reviewing files that changed from the base of the PR and between 9e04d79 and b47a960.
Files selected for processing: 2
includes/Options.php
readme.txt
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On multisite, when the plugin is not network-activated, settings were saved to the per-site
wp_N_optionstable but always read withget_site_option(), which returns the network-level value. Sub-sites therefore saved their settings, never saw them again, and fell back to defaults (or to the primary site's values once it was configured).Reported at https://wordpress.org/support/topic/multi-log-config/
Changes
includes/Options.php:get_options()now reads from the same storeupdate_options()writes to: network option when network-activated, per-site option otherwise.switch_to_blog()cannot return another site's cached settings.readme.txt: changelog entry.Verification
Ran the real
Optionsclass against a local multisite (plugin not network-active), savingtimer=17on blog 4 and then forcing a fresh read:5(reproduces the report).17; blogs 5 and 1 stayed at the default5.composer lint(PHPCS/PHPStan) andnpm run lintpass with no errors.Not run: the PHPUnit suite (needs a disposable
_testdatabase) and browser testing. The existing multisite test bootstrap network-activates the plugin, so it exercises only the network path; no new test added.aidevops.sh v3.39.147 plugin for OpenCode
Summary by CodeRabbit