On second thought, allow posts_per_rss to be set in pre_get_posts to override the posts_per_rss option. There are backwards compatibility concerns otherwise.

Props nacin.
Partially reverts [27455]. Updates the unit test. See #25380.


Built from https://develop.svn.wordpress.org/trunk@27456


git-svn-id: http://core.svn.wordpress.org/trunk@27302 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-03-07 18:59:14 +00:00
parent bc968895cc
commit c92f58a6d5

View File

@ -2248,12 +2248,8 @@ class WP_Query {
$q['post_type'] = '';
}
$post_type = $q['post_type'];
if ( ! isset( $q['posts_per_page'] ) || $q['posts_per_page'] == 0 ) {
if ( $this->is_feed ) {
$q['posts_per_page'] = get_option( 'posts_per_rss' );
} else {
$q['posts_per_page'] = get_option( 'posts_per_page' );
}
if ( empty( $q['posts_per_page'] ) ) {
$q['posts_per_page'] = get_option( 'posts_per_page' );
}
if ( isset($q['showposts']) && $q['showposts'] ) {
$q['showposts'] = (int) $q['showposts'];
@ -2269,6 +2265,12 @@ class WP_Query {
}
}
if ( $this->is_feed ) {
// This overrides posts_per_page.
if ( ! empty( $q['posts_per_rss'] ) ) {
$q['posts_per_page'] = $q['posts_per_rss'];
} else {
$q['posts_per_page'] = get_option( 'posts_per_rss' );
}
$q['nopaging'] = false;
}
$q['posts_per_page'] = (int) $q['posts_per_page'];