Changeset 27455
- Timestamp:
- 03/07/2014 06:32:40 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/query.php
r27395 r27455 2249 2249 } 2250 2250 $post_type = $q['post_type']; 2251 if ( !isset($q['posts_per_page']) || $q['posts_per_page'] == 0 ) 2252 $q['posts_per_page'] = get_option('posts_per_page'); 2251 if ( ! isset( $q['posts_per_page'] ) || $q['posts_per_page'] == 0 ) { 2252 if ( $this->is_feed ) { 2253 $q['posts_per_page'] = get_option( 'posts_per_rss' ); 2254 } else { 2255 $q['posts_per_page'] = get_option( 'posts_per_page' ); 2256 } 2257 } 2253 2258 if ( isset($q['showposts']) && $q['showposts'] ) { 2254 2259 $q['showposts'] = (int) $q['showposts']; … … 2265 2270 } 2266 2271 if ( $this->is_feed ) { 2267 $q['posts_per_page'] = get_option('posts_per_rss');2268 2272 $q['nopaging'] = false; 2269 2273 } -
trunk/tests/phpunit/tests/query.php
r27304 r27455 88 88 $this->assertTrue( $query->get( 'nonexistent', true ) ); 89 89 } 90 91 /** 92 * @ticket 25380 93 */ 94 function test_pre_posts_per_page() { 95 $this->factory->post->create_many( 10 ); 96 97 add_action( 'pre_get_posts', array( $this, 'filter_posts_per_page' ) ); 98 99 $this->go_to( get_feed_link() ); 100 101 $this->assertEquals( 30, get_query_var( 'posts_per_page' ) ); 102 } 103 104 function filter_posts_per_page( &$query ) { 105 $query->set( 'posts_per_page', 30 ); 106 } 90 107 }
Note: See TracChangeset
for help on using the changeset viewer.