Make WordPress Core


Ignore:
Timestamp:
01/10/2016 04:05:26 AM (8 years ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r36244 r36252  
    16051605
    16061606    if ( $number && is_array( $terms ) && count( $terms ) > $number ) {
    1607         $terms = array_slice( $terms, $offset, $number );
     1607        $terms = array_slice( $terms, $offset, $number, true );
    16081608    }
    16091609
Note: See TracChangeset for help on using the changeset viewer.