mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@49538 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -4926,7 +4926,7 @@ class Tests_Comment_Query extends WP_UnitTestCase {
|
||||
$q = new WP_Comment_Query();
|
||||
$results = $q->query( array() );
|
||||
|
||||
remove_filter( 'comments_pre_query', array( __CLASS__, 'filter_comments_pre_query_and_set_comments' ), 10, 2 );
|
||||
remove_filter( 'comments_pre_query', array( __CLASS__, 'filter_comments_pre_query_and_set_comments' ), 10 );
|
||||
|
||||
// Make sure the comments property is the same as the results.
|
||||
$this->assertSame( $results, $q->comments );
|
||||
|
||||
Reference in New Issue
Block a user