[wp-trac] [WordPress Trac] #45749: Add short circuits for multisite classes.

WordPress Trac noreply at wordpress.org
Fri Mar 22 17:25:45 UTC 2019


#45749: Add short circuits for multisite classes.
---------------------------------------------+-----------------------------
 Reporter:  spacedmonkey                     |       Owner:
                                             |  adamsilverstein
     Type:  enhancement                      |      Status:  closed
 Priority:  normal                           |   Milestone:  5.2
Component:  Networks and Sites               |     Version:  4.6
 Severity:  normal                           |  Resolution:  fixed
 Keywords:  has-patch commit needs-dev-note  |     Focuses:  multisite
---------------------------------------------+-----------------------------
Changes (by adamsilverstein):

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


Comment:

 In [changeset:"44983" 44983]:
 {{{
 #!CommitTicketReference repository="" revision="44983"
 Multisite: add new `sites_pre_query` and `networks_pre_query` filters to
 short circuit WP_Site_Query and WP_Network_Query queries.

 Similar to the `posts_pre_query` filter for WP_Query added in #36687.
 These filters lets you short circuit the queries to return your own
 results.

 Add a new filter `sites_pre_query` - which returns null by default. Return
 a non-null value to bypass WordPress's default `get_sites` queries.

 Developers should note that filtering functions that require pagination
 information are encouraged to set the `found_sites` property of the
 `WP_Site_Query` object, passed to the filter by reference. If
 `WP_Site_Query` does not perform a database query, it will not have enough
 information to generate these values itself.

 Add a new filter `networks_pre_query` - which returns null by default.
 Return a non-null value to bypass WordPress's default `get_networks`
 queries.

 Developers should note that filtering functions that require pagination
 information are encouraged to set the `found_networks` property of the
 `WP_Network_Query` object, passed to the filter by reference. If
 `WP_Network_Query` does not perform a database query, it will not have
 enough information to generate these values itself.

 Props spacedmonkey.
 Fixes #45749.
 }}}

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


More information about the wp-trac mailing list