WP_Query should not ignore an offset of 0.

Props mazurstas.
Fixes #34060.
Built from https://develop.svn.wordpress.org/trunk@34697


git-svn-id: http://core.svn.wordpress.org/trunk@34661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2015-09-29 19:37:23 +00:00
parent 5b32e27a00
commit c36d4fb8a9
2 changed files with 6 additions and 5 deletions

View File

@ -3123,11 +3123,12 @@ class WP_Query {
if ( !$page )
$page = 1;
if ( empty($q['offset']) ) {
$pgstrt = absint( ( $page - 1 ) * $q['posts_per_page'] ) . ', ';
} else { // we're ignoring $page and using 'offset'
$q['offset'] = absint($q['offset']);
// If 'offset' is provided, it takes precedence over 'paged'.
if ( isset( $q['offset'] ) && is_numeric( $q['offset'] ) ) {
$q['offset'] = absint( $q['offset'] );
$pgstrt = $q['offset'] . ', ';
} else {
$pgstrt = absint( ( $page - 1 ) * $q['posts_per_page'] ) . ', ';
}
$limits = 'LIMIT ' . $pgstrt . $q['posts_per_page'];
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34696';
$wp_version = '4.4-alpha-34697';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.