diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php index 40955b3c1d..4c495041af 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php @@ -1923,10 +1923,16 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { case 'post-formats': $supports_formats = get_theme_support( 'post-formats' ); + + // Force to an array. Supports formats can return true even if empty in some cases. + $supports_formats = is_array( $supports_formats ) ? array_values( $supports_formats[0] ) : array(); + + $supported_formats = array_merge( array( 'standard' ), $supports_formats ); + $schema['properties']['format'] = array( 'description' => __( 'The format for the object.' ), 'type' => 'string', - 'enum' => array_merge( array( 'standard' ), $supports_formats ? array_values( $supports_formats[0] ) : array() ), + 'enum' => $supported_formats, 'context' => array( 'view', 'edit' ), ); break; diff --git a/wp-includes/version.php b/wp-includes/version.php index b95578e02a..ece4f3b5dd 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.8-alpha-39619'; +$wp_version = '4.8-alpha-39620'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.