Make WordPress Core


Ignore:
Timestamp:
07/01/2020 06:06:39 AM (4 years ago)
Author:
gziolo
Message:

Editor: More strict checks for globals in render_block

Props kraftbj.
Fixes #49927.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks.php

    r48226 r48243  
    686686    $context = array();
    687687
    688     if ( ! empty( $post ) ) {
     688    if ( $post instanceof WP_Post ) {
    689689        $context['postId'] = $post->ID;
    690690
     
    698698    }
    699699
    700     if ( isset( $wp_query->tax_query->queried_terms['category'] ) ) {
     700    if ( $wp_query instanceof WP_Query && isset( $wp_query->tax_query->queried_terms['category'] ) ) {
    701701        $context['query'] = array( 'categoryIds' => array() );
    702702        foreach ( $wp_query->tax_query->queried_terms['category']['terms'] as $category_slug_or_id ) {
Note: See TracChangeset for help on using the changeset viewer.