[wp-trac] [WordPress Trac] #51333: Assign 'sites_pre_query' and 'networks_pre_query' filter results to the class property

WordPress Trac noreply at wordpress.org
Sun Nov 8 11:45:50 UTC 2020


#51333: Assign 'sites_pre_query' and 'networks_pre_query' filter results to the
class property
-------------------------------------------------+-------------------------
 Reporter:  SergeyBiryukov                       |       Owner:
                                                 |  SergeyBiryukov
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  5.6
Component:  Networks and Sites                   |     Version:
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  good-first-bug has-patch has-unit-   |     Focuses:  multisite
  tests                                          |
-------------------------------------------------+-------------------------
Changes (by SergeyBiryukov):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"49538" 49538]:
 {{{
 #!CommitTicketReference repository="" revision="49538"
 Networks and Sites: Assign the array of site or network data returned from
 filters to the respective class property:

 * The array of network data returned from the `networks_pre_query` filter
 is assigned to the `networks` property of the current `WP_Network_Query`
 instance.
 * The array of site data returned from the `sites_pre_query` filter is
 assigned to the `sites` property of the current `WP_Site_Query` instance.

 This avoids the performance overhead of calling
 `WP_Network_Query::get_networks()` or `WP_Site_Query::get_sites()` twice:
 first when creating the object instance, then to retrieve the filtered
 results.

 This also makes the filters a bit more consistent with other similar
 filters, e.g. `posts_pre_query`, `terms_pre_query`, `comments_pre_query`,
 or `users_pre_query`.

 Follow-up to [46086], [48990].

 Props yakimun, spacedmonkey.
 Fixes #51333.
 }}}

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


More information about the wp-trac mailing list