Ticket #42261: 42261.1.diff
File 42261.1.diff, 1.9 KB (added by , 6 years ago) |
---|
-
src/wp-includes/class-wp-query.php
1806 1806 if ( ( isset( $q['posts_per_archive_page'] ) && $q['posts_per_archive_page'] != 0 ) && ( $this->is_archive || $this->is_search ) ) { 1807 1807 $q['posts_per_page'] = $q['posts_per_archive_page']; 1808 1808 } 1809 if ( $this->is_feed ) { 1810 // This overrides posts_per_page. 1811 if ( ! empty( $q['posts_per_rss'] ) ) { 1812 $q['posts_per_page'] = $q['posts_per_rss']; 1813 } else { 1814 $q['posts_per_page'] = get_option( 'posts_per_rss' ); 1815 } 1816 } 1809 1817 if ( ! isset( $q['nopaging'] ) ) { 1810 1818 if ( $q['posts_per_page'] == -1 ) { 1811 1819 $q['nopaging'] = true; … … 1814 1822 } 1815 1823 } 1816 1824 1817 if ( $this->is_feed ) {1818 // This overrides posts_per_page.1819 if ( ! empty( $q['posts_per_rss'] ) ) {1820 $q['posts_per_page'] = $q['posts_per_rss'];1821 } else {1822 $q['posts_per_page'] = get_option( 'posts_per_rss' );1823 }1824 $q['nopaging'] = false;1825 }1826 1825 $q['posts_per_page'] = (int) $q['posts_per_page']; 1827 1826 if ( $q['posts_per_page'] < -1 ) { 1828 1827 $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_filter( 'option_posts_per_rss', array( $this, 'filter_option_posts_per_rss' ) ); 67 68 $this->go_to( get_feed_link() ); 69 70 global $wp_query; 71 72 $this->assertEquals( 15, count( $wp_query->posts ) ); 73 } 74 75 public function filter_option_posts_per_rss() { 76 return -1; 77 } 78 79 /** 60 80 * @ticket 26627 61 81 */ 62 82 function test_tag_queried_object() {