WordPress.org

Make WordPress Core

Changeset 27456


Ignore:
Timestamp:
03/07/2014 06:58:33 PM (6 years ago)
Author:
wonderboymusic
Message:

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.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/query.php

    r27455 r27456  
    22492249        }
    22502250        $post_type = $q['post_type'];
    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             }
     2251        if ( empty( $q['posts_per_page'] ) ) {
     2252            $q['posts_per_page'] = get_option( 'posts_per_page' );
    22572253        }
    22582254        if ( isset($q['showposts']) && $q['showposts'] ) {
     
    22702266        }
    22712267        if ( $this->is_feed ) {
     2268            // This overrides posts_per_page.
     2269            if ( ! empty( $q['posts_per_rss'] ) ) {
     2270                $q['posts_per_page'] = $q['posts_per_rss'];
     2271            } else {
     2272                $q['posts_per_page'] = get_option( 'posts_per_rss' );
     2273            }
    22722274            $q['nopaging'] = false;
    22732275        }
  • trunk/tests/phpunit/tests/query.php

    r27455 r27456  
    103103
    104104    function filter_posts_per_page( &$query ) {
    105         $query->set( 'posts_per_page', 30 );
     105        $query->set( 'posts_per_rss', 30 );
    106106    }
    107107}
Note: See TracChangeset for help on using the changeset viewer.