REST API: Always return post types list in taxonomies endpoint response as an array.

Prevents a non-sequential post type array such as [ 0 => 'post', 2 => 'page' ] from being improperly converted to an object in the taxonomy endpoint's response JSON.

Props TimothyBlynJacobs, birgire, spectacula.
Fixes #42209.

Built from https://develop.svn.wordpress.org/trunk@45813


git-svn-id: http://core.svn.wordpress.org/trunk@45624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
K. Adam White 2019-08-15 22:12:55 +00:00
parent 00cb4c7dbd
commit 7eed5eff61
2 changed files with 2 additions and 2 deletions

View File

@ -210,7 +210,7 @@ class WP_REST_Taxonomies_Controller extends WP_REST_Controller {
}
if ( in_array( 'types', $fields, true ) ) {
$data['types'] = $taxonomy->object_type;
$data['types'] = array_values( $taxonomy->object_type );
}
if ( in_array( 'show_cloud', $fields, true ) ) {

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-alpha-45812';
$wp_version = '5.3-alpha-45813';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.