From eeb4d75c573b6cbc520bef9c71b4fa917f2d8a37 Mon Sep 17 00:00:00 2001 From: gziolo Date: Wed, 1 Jul 2020 06:08:06 +0000 Subject: [PATCH] Editor: More strict checks for globals in render_block Props kraftbj. Fixes #49927. Built from https://develop.svn.wordpress.org/trunk@48243 git-svn-id: http://core.svn.wordpress.org/trunk@48012 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/blocks.php | 4 ++-- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/blocks.php b/wp-includes/blocks.php index 0e6b6a63f4..2eec688b75 100644 --- a/wp-includes/blocks.php +++ b/wp-includes/blocks.php @@ -685,7 +685,7 @@ function render_block( $parsed_block ) { $context = array(); - if ( ! empty( $post ) ) { + if ( $post instanceof WP_Post ) { $context['postId'] = $post->ID; /* @@ -697,7 +697,7 @@ function render_block( $parsed_block ) { $context['postType'] = $post->post_type; } - if ( isset( $wp_query->tax_query->queried_terms['category'] ) ) { + if ( $wp_query instanceof WP_Query && isset( $wp_query->tax_query->queried_terms['category'] ) ) { $context['query'] = array( 'categoryIds' => array() ); foreach ( $wp_query->tax_query->queried_terms['category']['terms'] as $category_slug_or_id ) { $context['query']['categoryIds'][] = 'slug' === $wp_query->tax_query->queried_terms['category']['field'] ? get_cat_ID( $category_slug_or_id ) : $category_slug_or_id; diff --git a/wp-includes/version.php b/wp-includes/version.php index e3fd9af6a1..552839a799 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-48242'; +$wp_version = '5.5-alpha-48243'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.