[wp-trac] [WordPress Trac] #55137: WP_Query max_num_pages returns float instead of int

WordPress Trac noreply at wordpress.org
Thu Feb 10 14:06:46 UTC 2022


#55137: WP_Query max_num_pages returns float instead of int
--------------------------+------------------------------
 Reporter:  bkrnetic      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Query         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  dev-feedback  |     Focuses:  docs
--------------------------+------------------------------
Changes (by audrasjb):

 * focuses:   => docs
 * version:  5.8.3 =>


Comment:

 Hello and thank you for opening this ticket,

 Theoretically, that's right: `ceil` will return a float and not an
 integer.
 {{{
 $this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] );
 }}}

 https://www.php.net/manual/function.ceil.php

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


More information about the wp-trac mailing list