#56870 closed enhancement (fixed)
Introduce a general `pre_site_option` filter in `get_network_option()`
| Reported by: | | Owned by: | |
|---|---|---|---|
| Milestone: | 6.9 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Networks and Sites | Keywords: | has-patch has-unit-tests commit |
| Focuses: | multisite | Cc: |
Description
Similar to the new filter from #37930 I suggest to also add a general pre_site_option filter.
I attach a patch to add the filter.
Don't know how to create the test for it.
Attachments (1)
Change History (12)
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
2 months ago
#3
@
2 months ago
- Milestone changed from Awaiting Review to 6.9
As per today's devchat: this proposal sounds quite reasonable given we already introduced pre_option previously.
I'm moving it to milestone 6.9. Patch refresh coming soon.
This ticket was mentioned in PR #10030 on WordPress/wordpress-develop by @audrasjb.
2 months ago #4
- Keywords has-patch added
This ticket was mentioned in PR #10053 on WordPress/wordpress-develop by @nimeshatxecurify.
8 weeks ago #5
- Keywords has-unit-tests added
Adding unit test and making changes in @audrasjb 's PR (#10030) as per suggestions from @jorbin
This ticket was mentioned in Slack in #core by welcher. View the logs.
6 weeks ago
#7
@
6 weeks ago
@audrasjb we're getting close to the 6.9 Beta 1 cutoff, is there anything else that needs to happen on this ticket to get it over the finish line?
#8
@
5 weeks ago
- Keywords commit added
There is a minor update to the test as noted by @westonruter on the PR. Otherwise https://github.com/WordPress/wordpress-develop/pull/10053/files looks ready. Planning to commit this in the next few days unless there is an objection.
#9
@
5 weeks ago
Test Report
Description
This report validates whether the indicated patch works as expected.
Patch tested: https://github.com/WordPress/wordpress-develop/pull/10053
Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.29
- Server: nginx/1.29.2
- Database: mysqli (Server: 8.4.6 / Client: mysqlnd 8.2.29)
- Browser: Chrome 140.0.0.0
- OS: Linux
- Theme: Twenty Twenty-Five 1.3
- MU Plugins: None activated
- Plugins:
- Gutenberg 21.7.0
- Test Reports 1.2.0
Actual Results
- ✅ pre_site_option filter correctly
add_filter( 'pre_site_option', function( $pre, $option, $network_id ) { if ( 'site_name' === $option ) { return 'Filtered Network Name'; } return $pre; }, 10, 3 ); // Output: "Filtered Network Name" echo get_network_option( get_current_network_id(), 'site_name' );
Additional Notes
- Executed the following commands in a local wordpress-develop clone:
git fetch upstream pull/10053/head:pr-10053 git checkout pr-10053 npm run env:restart
- Patch successfully introduces the general pre_site_option hook for multisite.
- Dynamic filter pre_site_option_{$option} remains functional.
Supplemental Artifacts
#10
@
5 weeks ago
- Owner set to johnjamesjacoby
- Resolution set to fixed
- Status changed from new to closed
In 60959:
#11
@
4 days ago
The miscellaneous developer-focused changes developer note mentioned the new pre_site_option hook introduced in [60959] but did not cover its usage in depth: https://make.wordpress.org/core/2025/11/17/miscellaneous-developer-focused-changes-in-6-9/.

Removing
trunkas theVersiongiven this is a request for a new filter.