Changeset 56381
- Timestamp:
- 08/10/2023 10:24:29 AM (14 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-user-query.php
r56353 r56381 1072 1072 $blog_id = absint( $args['blog_id'] ); 1073 1073 } 1074 if ( ( $args['has_published_posts'] && $blog_id ) || in_array( 'post_count', $ordersby, true ) ) { 1075 $switch = get_current_blog_id() !== $blog_id; 1074 1075 if ( $args['has_published_posts'] || in_array( 'post_count', $ordersby, true ) ) { 1076 $switch = $blog_id && get_current_blog_id() !== $blog_id; 1076 1077 if ( $switch ) { 1077 1078 switch_to_blog( $blog_id ); 1078 1079 } 1080 1079 1081 $last_changed .= wp_cache_get_last_changed( 'posts' ); 1082 1080 1083 if ( $switch ) { 1081 1084 restore_current_blog(); -
trunk/tests/phpunit/tests/user/queryCache.php
r55657 r56381 779 779 $this->assertSame( $cache_key_1, $cache_key_2, 'Cache key differs when using wpdb placeholder.' ); 780 780 } 781 782 /** 783 * Verifies that generate_cache_key() does not throw a fatal error for switch_to_blog() 784 * with 'orderby' => 'post_count' and the deprecated 'who' => 'authors' parameter. 785 * 786 * @ticket 59011 787 * @covers ::generate_cache_key 788 * 789 * @expectedDeprecated WP_User_Query 790 */ 791 public function test_generate_cache_key_with_orderby_post_count_and_deprecated_who_parameter() { 792 $query = new WP_User_Query( 793 array( 794 'fields' => 'ID', 795 'orderby' => 'post_count', 796 'order' => 'DESC', 797 'who' => 'authors', 798 ) 799 ); 800 801 $this->assertNotEmpty( $query->get_results() ); 802 } 781 803 }
Note: See TracChangeset
for help on using the changeset viewer.