Make WordPress Core


Ignore:
Timestamp:
09/29/2015 07:36:16 PM (9 years ago)
Author:
boonebgorges
Message:

WP_Query should not ignore an offset of 0.

Props mazurstas.
Fixes #34060.

File:
1 edited

Legend:

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

    r34690 r34697  
    31243124                $page = 1;
    31253125
    3126             if ( empty($q['offset']) ) {
     3126            // If 'offset' is provided, it takes precedence over 'paged'.
     3127            if ( isset( $q['offset'] ) && is_numeric( $q['offset'] ) ) {
     3128                $q['offset'] = absint( $q['offset'] );
     3129                $pgstrt = $q['offset'] . ', ';
     3130            } else {
    31273131                $pgstrt = absint( ( $page - 1 ) * $q['posts_per_page'] ) . ', ';
    3128             } else { // we're ignoring $page and using 'offset'
    3129                 $q['offset'] = absint($q['offset']);
    3130                 $pgstrt = $q['offset'] . ', ';
    31313132            }
    31323133            $limits = 'LIMIT ' . $pgstrt . $q['posts_per_page'];
Note: See TracChangeset for help on using the changeset viewer.