Make WordPress Core

Changeset 56731


Ignore:
Timestamp:
09/27/2023 05:10:28 AM (9 months ago)
Author:
isabel_brison
Message:

Editor: fix undefined array key warning.

Checks if attrs array key exists before using its value.

Props mukesh27, kafleg.
Fixes #59468.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-supports/background.php

    r56709 r56731  
    4949function wp_render_background_support( $block_content, $block ) {
    5050    $block_type                   = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );
    51     $block_attributes             = $block['attrs'];
     51    $block_attributes             = ( isset( $block['attrs'] ) && is_array( $block['attrs'] ) ) ? $block['attrs'] : array();
    5252    $has_background_image_support = block_has_support( $block_type, array( 'background', 'backgroundImage' ), false );
    5353
Note: See TracChangeset for help on using the changeset viewer.