[wp-trac] [WordPress Trac] #29644: query_posts doesn't support -1 value for posts_per_page if argument is an array

WordPress Trac noreply at wordpress.org
Sun Sep 14 02:06:22 UTC 2014


#29644: query_posts doesn't support -1 value for posts_per_page if argument is an
array
-------------------------------------+------------------------------
 Reporter:  stratboy                 |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Query                    |     Version:  4.0
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+------------------------------
Changes (by collinsinternet):

 * keywords:  reporter-feedback => has-patch needs-testing


Comment:

 stratboy,  thank you for the information.  By creating a custom post type,
 custom taxonomy and a taxonomy template I was able to duplicate the issue.

 It appears that the $wp_query->query_vars['nopaging'] variable is the
 cause.  If this variable is empty, the SQL LIMIT gets set to whatever the
 value of posts_per_page is.  If it is -1, the LIMIT gets set to -1 and
 results in a SQL error.

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


More information about the wp-trac mailing list