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.
Built from https://develop.svn.wordpress.org/trunk@36252


git-svn-id: http://core.svn.wordpress.org/trunk@36219 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2016-01-10 04:06:25 +00:00
parent cfae56d2c2
commit 909470db67
2 changed files with 2 additions and 2 deletions

View File

@ -1604,7 +1604,7 @@ function get_terms( $taxonomies, $args = '' ) {
}
if ( $number && is_array( $terms ) && count( $terms ) > $number ) {
$terms = array_slice( $terms, $offset, $number );
$terms = array_slice( $terms, $offset, $number, true );
}
wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-alpha-36251';
$wp_version = '4.5-alpha-36252';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.