[wp-trac] [WordPress Trac] #24142: Zero value for posts_per_page value in wp_query custom instance and for 'Blog pages show at most' option

WordPress Trac noreply at wordpress.org
Mon Jun 15 12:46:25 UTC 2015


#24142: Zero value for posts_per_page value in wp_query custom instance and for
'Blog pages show at most' option
------------------------------------------+-----------------------------
 Reporter:  alexvorn2                     |       Owner:
     Type:  defect (bug)                  |      Status:  reopened
 Priority:  normal                        |   Milestone:  Future Release
Component:  Query                         |     Version:
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+-----------------------------
Changes (by boonebgorges):

 * keywords:   => needs-patch needs-unit-tests
 * milestone:   => Future Release


Comment:

 I agree that it's a bit odd to create a `WP_Query` with
 `posts_per_page=0`, but I also think there's no reason we shouldn't
 support it. The culprit appears to be
 https://core.trac.wordpress.org/browser/tags/4.2.2/src/wp-
 includes/query.php#L2460. Something like `0 === $q['posts_per_page'] ||
 '0' === $q['posts_per_page']` is probably going to work, but this needs
 unit tests.

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


More information about the wp-trac mailing list