Changeset 52990
- Timestamp:
- 03/25/2022 09:54:52 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-query.php
r52985 r52990 3264 3264 'post_type' => $post_type, 3265 3265 'post_status' => 'publish', 3266 'posts_per_page' => count( $sticky_posts ), 3266 3267 'suppress_filters' => $q['suppress_filters'], 3267 3268 'cache_results' => $q['cache_results'], -
trunk/tests/phpunit/tests/query/stickies.php
r52985 r52990 127 127 $this->assertTrue( $sticky_query_vars['no_found_rows'] ); 128 128 } 129 130 /** 131 * @ticket 36907 132 */ 133 public function test_stickies_should_limit_query() { 134 $sticky_count = 6; 135 $post_date = gmdate( 'Y-m-d H:i:s', time() - 10000 ); 136 $post_ids = self::factory()->post->create_many( $sticky_count, array( 'post_date' => $post_date ) ); 137 add_filter( 138 'pre_option_sticky_posts', 139 function () use ( $post_ids ) { 140 return $post_ids; 141 } 142 ); 143 144 $filter = new MockAction(); 145 add_filter( 'posts_pre_query', array( $filter, 'filter' ), 10, 2 ); 146 $this->go_to( '/' ); 147 $filter_args = $filter->get_args(); 148 $sticky_query_vars = $filter_args[1][1]->query_vars; 149 150 $this->assertSame( $sticky_query_vars['posts_per_page'], $sticky_count ); 151 } 129 152 }
Note: See TracChangeset
for help on using the changeset viewer.