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:
@@ -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'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user