[wp-trac] [WordPress Trac] #36687: Feature to override WP_Query to provide results from other source

WordPress Trac noreply at wordpress.org
Wed Jun 15 11:18:04 UTC 2016


#36687: Feature to override WP_Query to provide results from other source
-----------------------------------+--------------------------
 Reporter:  jpdavoutian            |       Owner:  jpdavoutian
     Type:  feature request        |      Status:  reopened
 Priority:  normal                 |   Milestone:  4.6
Component:  Query                  |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:
-----------------------------------+--------------------------

Comment (by jadpm):

 The last change has broken simple queries counters. On a vanilla new
 install with the SVN trunk version of WordPress, no plugins and default
 theme, running a simple query sets `max_num_pages` to 1 even when it
 shoudl be another value.

 Consider a clean site with just 16 posts and the following query added to
 the footer of the theme:
 {{{#!php
 <?php
 $ek_query_args = array(
         'post_type'             => 'post',
         'posts_per_page'        => 5
 );
 $ek_query = new WP_Query( $ek_query_args );
 }}}

 In that case, `$ek_query->max_num_pages` should be 4. With the latest
 changes on `query.php` it defaults to 1. Reverting to the very previous
 version of that file states the right 4 number of pages. Note that there
 is no (at least external) filter on `posts_pre_query` whatsoever.

 Note that this also applies to native builtin queries. The Homepage set as
 the blog page, with a setting of 2 posts per page and 16 posts on the site
 is displaying obviously no pagination controls on TwentySixteen, since,
 well, the page counter has become 1.

 Please revert and test properly before commiting again.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36687#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list