[wp-trac] [WordPress Trac] #8832: function get_categories() doesn't work properly when using child_of and number parameters

WordPress Trac noreply at wordpress.org
Wed Feb 24 19:12:47 UTC 2016


#8832: function get_categories() doesn't work properly when using child_of and
number parameters
-------------------------------------------------+---------------------
 Reporter:  jidm                                 |       Owner:  ryan
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  2.7.1
Component:  Taxonomy                             |     Version:  2.7
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch get_terms number child_of  |
-------------------------------------------------+---------------------

Comment (by boonebgorges):

 In [changeset:"36691"]:
 {{{
 #!CommitTicketReference repository="" revision="36691"
 Improve 'offset' calculation when querying for hierarchical terms.

 When querying for terms in hierarchical taxonomies, `get_terms()`
 initially
 queries for all matching terms, and then trims the located results based
 on the
 `$number` and `$offset` arguments passed to the function. See #8832.
 However,
 a flaw in the original logic meant that results were failing to be trimmed
 properly in cases where `$offset` exceeds the total number of matching
 terms;
 in these cases, we should force an empty array.

 Props danielbachhuber.
 Fixes #35935.
 }}}

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


More information about the wp-trac mailing list