[wp-trac] [WordPress Trac] #45749: Add short circuits for multisite classes.
WordPress Trac
noreply at wordpress.org
Fri Mar 22 00:59:00 UTC 2019
#45749: Add short circuits for multisite classes.
--------------------------------+------------------------------
Reporter: spacedmonkey | Owner: adamsilverstein
Type: enhancement | Status: assigned
Priority: normal | Milestone: 5.2
Component: Networks and Sites | Version: 4.6
Severity: normal | Resolution:
Keywords: has-patch commit | Focuses: multisite
--------------------------------+------------------------------
Comment (by adamsilverstein):
@spacedmonkey Thanks! Running tests on [attachment:"45749.5.diff"], code
looks good.
Does this look good for the commit message?
Multisite: add a `sites_pre_query` filter to short circuit WP_Site_Query
queries.
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.
Similar to the `posts_pre_query` filter for WP_Query added in #36687. This
filter lets you short circuit the WP_Site_Query query to return your own
results.
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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45749#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list