[wp-trac] [WordPress Trac] #56870: Introduce a general `pre_site_option` filter in `get_network_option()`

WordPress Trac noreply at wordpress.org
Fri Oct 17 06:35:30 UTC 2025


#56870: Introduce a general `pre_site_option` filter in `get_network_option()`
---------------------------------------------+------------------------
 Reporter:  Drivingralle                     |       Owner:  (none)
     Type:  enhancement                      |      Status:  new
 Priority:  normal                           |   Milestone:  6.9
Component:  Networks and Sites               |     Version:
 Severity:  normal                           |  Resolution:
 Keywords:  has-patch has-unit-tests commit  |     Focuses:  multisite
---------------------------------------------+------------------------

Comment (by rollybueno):

 == 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
 1. ✅ 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' );
 }}}
 2. The filter receives correct arguments and bypasses DB retrieval.

 === Additional Notes
 1. 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
 }}}
 2. Patch successfully introduces the general pre_site_option hook for
 multisite.
 3. Dynamic filter pre_site_option_{$option} remains functional.

 === Supplemental Artifacts
 Test unit result
 [[Image(https://i.imgur.com/cIflgGX.png)]]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56870#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list