diff --git a/wp-includes/class-wp-theme-json-resolver.php b/wp-includes/class-wp-theme-json-resolver.php index 1924d1a471..e696eef894 100644 --- a/wp-includes/class-wp-theme-json-resolver.php +++ b/wp-includes/class-wp-theme-json-resolver.php @@ -515,7 +515,7 @@ class WP_Theme_JSON_Resolver { $global_style_query = new WP_Query(); $recent_posts = $global_style_query->query( $args ); - if ( count( $recent_posts ) === 1 ) { + if ( count( $recent_posts ) === 1 && $recent_posts[0] instanceof WP_Post ) { $user_cpt = get_object_vars( $recent_posts[0] ); } elseif ( $create_post ) { $cpt_post_id = wp_insert_post( @@ -532,7 +532,10 @@ class WP_Theme_JSON_Resolver { true ); if ( ! is_wp_error( $cpt_post_id ) ) { - $user_cpt = get_object_vars( get_post( $cpt_post_id ) ); + $post = get_post( $cpt_post_id ); + if ( $post instanceof WP_Post ) { + $user_cpt = get_object_vars( $post ); + } } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 20dbf719e3..333dadc3ae 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '7.0-alpha-61399'; +$wp_version = '7.0-alpha-61400'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.