Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#55137 closed defect (bug) (duplicate)

WP_Query max_num_pages returns float instead of int

Reported by: bkrnetic's profile bkrnetic Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Query Keywords: needs-patch
Focuses: docs Cc:

Description

The docs say that WP_Query max_num_pages property returns int but it returns float.

Change History (4)

#1 @audrasjb
3 years ago

  • Focuses docs added
  • Version 5.8.3 deleted

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

#2 @audrasjb
3 years ago

  • Keywords needs-patch added; dev-feedback removed

The same goes for other related queries:

  • WP_Network_Query
  • WP_Comment_Query
  • WP_Site_Query

#3 @SergeyBiryukov
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi there, welcome back to WordPress Trac!

Thanks for the report, we're already tracking this issue in #43372.

#4 @bkrnetic
3 years ago

Thanks a lot for your insights guys. Glad to hear that this is already handled. Cheers!

Note: See TracTickets for help on using tickets.