PluginProbe
Gutenberg / 24.1.0
Gutenberg v24.1.0
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
← All changes | build/scripts/block-library/post-content.php +12 -2 23.7.0 → 24.1.0 View file →
@@ -55,10 +55,20 @@
55 55 }
56 56
57 57 $tag_name = 'div';
58 58
59 - if ( ! empty( $attributes['tagName'] ) && tag_escape( $attributes['tagName'] ) === $attributes['tagName'] ) {
60 - $tag_name = $attributes['tagName'];
59 + if ( isset( $attributes['tagName'] ) && is_string( $attributes['tagName'] ) ) {
60 + /**
61 + * The allowed tag names match the options offered in the editor.
62 + *
63 + * @see packages/block-library/src/post-content/edit.jsx
64 + */
65 + $allowed_tag_names = array( 'div', 'main', 'section', 'article' );
66 + $normalized_tag_name = strtolower( $attributes['tagName'] );
67 +
68 + if ( in_array( $normalized_tag_name, $allowed_tag_names, true ) ) {
69 + $tag_name = $normalized_tag_name;
70 + }
61 71 }
62 72
63 73 $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => 'entry-content' ) );
64 74