From 7eed5eff619603bc3b05d0245d5531eb902437c3 Mon Sep 17 00:00:00 2001 From: "K. Adam White" Date: Thu, 15 Aug 2019 22:12:55 +0000 Subject: [PATCH] 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 --- .../rest-api/endpoints/class-wp-rest-taxonomies-controller.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php index 58ad748132..c0322f3a84 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php @@ -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 ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 64a34623ca..39fb727483 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.