[wp-trac] [WordPress Trac] #41936: get_main_site_id ignores custom values of $current_site->blog_id

WordPress Trac noreply at wordpress.org
Tue Oct 10 03:08:44 UTC 2017


#41936: get_main_site_id ignores custom values of $current_site->blog_id
--------------------------------------+------------------------------------
 Reporter:  spacedmonkey              |       Owner:  flixos90
     Type:  defect (bug)              |      Status:  assigned
 Priority:  normal                    |   Milestone:  4.9
Component:  Networks and Sites        |     Version:  trunk
 Severity:  normal                    |  Resolution:
 Keywords:  has-unit-tests has-patch  |     Focuses:  multisite,
                                      |  performance
--------------------------------------+------------------------------------

Comment (by flixos90):

 [attachment:41936.5.diff] is a minor update:

 * Ensure that the `$blog_id` property is always a string and that the
 `get_main_site_id()` method always returns an int.
 * Handle the filter separately, i.e. have it not set the `$blog_id`
 property.
 * Use an internal variable for the cache key instead of "hard-coding" it
 twice.
 * Keep the `return 1` if not multisite in the `get_main_site_id()`
 function for now, as this should be a separate commit.
 * Add two extra unit tests, one to ensure the property value is honored
 correctly, and another to ensure the filter still takes precedence.

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


More information about the wp-trac mailing list