Skip to content

Commit

Permalink
Only run set_inner_text when figcaption exists
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed Jun 16, 2024
1 parent dc3f85c commit 850fb84
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/wp-includes/class-wp-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,9 @@ public function set_inner_text( $new_content ) {
};

if ( 'core/image' === $this->name && 'caption' === $attribute_name ) {
$block_reader->next_tag( 'figcaption' );
$block_reader->set_inner_text( wp_kses_post( $source_value ) );
if ( $block_reader->next_tag( 'figcaption' ) ) {
$block_reader->set_inner_text( wp_kses_post( $source_value ) );
}
return $block_reader->get_updated_html();
}

Expand Down

0 comments on commit 850fb84

Please sign in to comment.