diff --git a/wp-includes/classes.php b/wp-includes/classes.php index 79709dbf1..a4ecc54c4 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -75,7 +75,7 @@ class retrospam_mgr { class WP { var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots'); - var $private_query_vars = array('posts_per_page', 'posts_per_archive_page', 'what_to_show', 'showposts', 'nopaging', 'post_type'); + var $private_query_vars = array('offset', 'posts_per_page', 'posts_per_archive_page', 'what_to_show', 'showposts', 'nopaging', 'post_type'); var $extra_query_vars = array(); var $query_vars; diff --git a/wp-includes/query.php b/wp-includes/query.php index db9253157..7d13881c6 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -874,9 +874,14 @@ class WP_Query { } if (($q['what_to_show'] == 'posts')) { - $pgstrt = ''; - $pgstrt = (intval($page) -1) * $q['posts_per_page'] . ', '; - $limits = 'LIMIT '.$pgstrt.$q['posts_per_page']; + if ( empty($q['offset']) ) { + $pgstrt = ''; + $pgstrt = (intval($page) -1) * $q['posts_per_page'] . ', '; + $limits = 'LIMIT '.$pgstrt.$q['posts_per_page']; + } else { // we're ignoring $page and using 'offset' + $pgstrt = intval($q['offset']) . ', '; + $limits = 'LIMIT ' . $pgstrt . $q['posts_per_page']; + } } elseif ($q['what_to_show'] == 'days') { $startrow = $q['posts_per_page'] * (intval($page)-1); $start_date = $wpdb->get_var("SELECT max(post_date) FROM $wpdb->posts $join WHERE (1=1) $where GROUP BY year(post_date), month(post_date), dayofmonth(post_date) ORDER BY post_date DESC LIMIT $startrow,1");