Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#35382 closed defect (bug) (fixed)

get_terms with set fields 'id=>parent' not return the id key

Reported by: fantasyworld Owned by: boonebgorges
Priority: normal Milestone: 4.5
Component: Taxonomy Version: 2.7.1
Severity: normal Keywords: good-first-bug has-patch
Cc: Focuses:

Description (last modified by dd32)

when use the id=>parent with number and fields in id=>name or and other id=>xx type.
In same case if the query return $terms array items in bigger then the number in you set with call the function.
It use the

<?php
array_slice( $terms, $offset, $number );

to cat the array into number you want
But this cat action will let the array id reset to 0, 1, 2 ... NOT the id of the term
may use the

<?php
array_slice( $terms, $offset, $number, true );

to keep the old id in the new array

Attachments (1)

35382.patch (481 bytes ) - added by wpdelighter 11 years ago.

Download all attachments as: .zip

Change History (5)

#1 @dd32
11 years ago

  • Description modified (diff)
  • Keywords needs-patch good-first-bug added
  • Version 4.4.12.7.1

Introduced with [10416]

@wpdelighter
11 years ago

#2 @wpdelighter
11 years ago

  • Keywords has-patch added; needs-patch removed

#3 @boonebgorges
11 years ago

  • Milestone Awaiting Review4.5

#4 @boonebgorges
11 years ago

  • Owner set to boonebgorges
  • Resolutionfixed
  • Status newclosed

In 36252:

Don't reset index keys when trimming results of term queries.

array_slice() must be told to preserve keys when the query results exceed the
limit specified the 'number' parameter, so that id=>parent and other
id-indexed return value formats don't get mangled.

Props fantasyworld, wpdelighter.
Fixes #35382.

Note: See TracTickets for help on using tickets.