[wp-trac] [WordPress Trac] #39764: 'pre_get_site_by_path' filter is called before plugin API is loaded

WordPress Trac noreply at wordpress.org
Fri Feb 10 17:50:50 UTC 2017


#39764: 'pre_get_site_by_path' filter is called before plugin API is loaded
----------------------------+------------------------
 Reporter:  Veraxus         |       Owner:
     Type:  defect (bug)    |      Status:  closed
 Priority:  normal          |   Milestone:
Component:  Bootstrap/Load  |     Version:  4.6
 Severity:  normal          |  Resolution:  invalid
 Keywords:                  |     Focuses:  multisite
----------------------------+------------------------
Changes (by johnbillion):

 * status:  new => closed
 * focuses:   => multisite
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 This filter is one of a few which are applied very early on during the
 bootstrap process of WordPress Multisite, before the current site has been
 determined.

 This filter fires before plugins are loaded, but it can be used within a
 custom `wp-content/sunrise.php` file. For example:

 {{{
 add_filter( 'pre_get_site_by_path', function( $site, $domain, $path,
 $segments, $paths ) {

         return WP_Site::get_instance( rand( 1, 10 ) );

 }, 10, 5 );
 }}}

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


More information about the wp-trac mailing list