summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/class.json-api.php')
-rw-r--r--plugins/jetpack/class.json-api.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/jetpack/class.json-api.php b/plugins/jetpack/class.json-api.php
index 923c80c8..c44d6bd9 100644
--- a/plugins/jetpack/class.json-api.php
+++ b/plugins/jetpack/class.json-api.php
@@ -496,7 +496,11 @@ class WPCOM_JSON_API {
foreach ( $response[ $key_to_filter ] as $key => $values ) {
if ( is_object( $values ) ) {
- $response[ $key_to_filter ][ $key ] = (object) array_intersect_key( (array) $values, array_flip( $fields ) );
+ if ( is_object( $response[ $key_to_filter ] ) ) {
+ $response[ $key_to_filter ]->$key = (object) array_intersect_key( ( (array) $values ), array_flip( $fields ) );
+ } elseif ( is_array( $response[ $key_to_filter ] ) ) {
+ $response[ $key_to_filter ][ $key ] = (object) array_intersect_key( ( (array) $values ), array_flip( $fields ) );
+ }
} elseif ( is_array( $values ) ) {
$response[ $key_to_filter ][ $key ] = array_intersect_key( $values, array_flip( $fields ) );
}