Ticket #42261: 42261.patch
File 42261.patch, 1.9 KB (added by , 7 years ago) |
---|
-
src/wp-includes/class-wp-query.php
1802 1802 if ( ( isset( $q['posts_per_archive_page'] ) && $q['posts_per_archive_page'] != 0 ) && ( $this->is_archive || $this->is_search ) ) { 1803 1803 $q['posts_per_page'] = $q['posts_per_archive_page']; 1804 1804 } 1805 if ( $this->is_feed ) { 1806 // This overrides posts_per_page. 1807 if ( ! empty( $q['posts_per_rss'] ) ) { 1808 $q['posts_per_page'] = $q['posts_per_rss']; 1809 } else { 1810 $q['posts_per_page'] = get_option( 'posts_per_rss' ); 1811 } 1812 } 1805 1813 if ( ! isset( $q['nopaging'] ) ) { 1806 1814 if ( $q['posts_per_page'] == -1 ) { 1807 1815 $q['nopaging'] = true; … … 1810 1818 } 1811 1819 } 1812 1820 1813 if ( $this->is_feed ) {1814 // This overrides posts_per_page.1815 if ( ! empty( $q['posts_per_rss'] ) ) {1816 $q['posts_per_page'] = $q['posts_per_rss'];1817 } else {1818 $q['posts_per_page'] = get_option( 'posts_per_rss' );1819 }1820 $q['nopaging'] = false;1821 }1822 1821 $q['posts_per_page'] = (int) $q['posts_per_page']; 1823 1822 if ( $q['posts_per_page'] < -1 ) { 1824 1823 $q['posts_per_page'] = abs( $q['posts_per_page'] ); -
tests/phpunit/tests/query.php
57 57 } 58 58 59 59 /** 60 * @ticket 42261 61 */ 62 function test_rss_query_no_limit() { 63 self::factory()->post->create_many( 15 ); 64 65 // Programmatically set posts_per_rss to -1 66 add_action( 'pre_get_posts', function() { 67 add_filter( 'option_posts_per_rss', function() { 68 return -1; 69 }); 70 }); 71 72 $this->go_to( get_feed_link() ); 73 74 global $wp_query; 75 76 $this->assertEquals( 15, count( $wp_query->posts ) ); 77 } 78 79 /** 60 80 * @ticket 26627 61 81 */ 62 82 function test_tag_queried_object() {