Skip to content

Commit 36be5bb

Browse files
committed
Theme_JSON_Resolver: check for WP_Post in query.
Props oandregal, mcsf, westonruter, mukesh27. Fixes #64434. Built from https://develop.svn.wordpress.org/trunk@61400 git-svn-id: http://core.svn.wordpress.org/trunk@60712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 parent 1033c6c commit 36be5bb

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

wp-includes/class-wp-theme-json-resolver.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ public static function get_user_data_from_wp_global_styles( $theme, $create_post
515515

516516
$global_style_query = new WP_Query();
517517
$recent_posts = $global_style_query->query( $args );
518-
if ( count( $recent_posts ) === 1 ) {
518+
if ( count( $recent_posts ) === 1 && $recent_posts[0] instanceof WP_Post ) {
519519
$user_cpt = get_object_vars( $recent_posts[0] );
520520
} elseif ( $create_post ) {
521521
$cpt_post_id = wp_insert_post(
@@ -532,7 +532,10 @@ public static function get_user_data_from_wp_global_styles( $theme, $create_post
532532
true
533533
);
534534
if ( ! is_wp_error( $cpt_post_id ) ) {
535-
$user_cpt = get_object_vars( get_post( $cpt_post_id ) );
535+
$post = get_post( $cpt_post_id );
536+
if ( $post instanceof WP_Post ) {
537+
$user_cpt = get_object_vars( $post );
538+
}
536539
}
537540
}
538541

wp-includes/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @global string $wp_version
1818
*/
19-
$wp_version = '7.0-alpha-61399';
19+
$wp_version = '7.0-alpha-61400';
2020

2121
/**
2222
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

0 commit comments

Comments
 (0)