diff --git a/mu-plugins/blocks/global-header-footer/blocks.php b/mu-plugins/blocks/global-header-footer/blocks.php index 77741954..1e0905f9 100644 --- a/mu-plugins/blocks/global-header-footer/blocks.php +++ b/mu-plugins/blocks/global-header-footer/blocks.php @@ -847,8 +847,16 @@ function render_global_footer( $attributes, $content, $block ) { $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => 'global-footer wp-block-group' ) ); + + $tag_name = $attributes['tagName']; + $allowed_tag_names = array( 'footer', 'div', 'section' ); + if ( ! $tag_name || ! in_array( $tag_name, $allowed_tag_names, true ) ) { + $tag_name = 'footer'; + } + return sprintf( - '%3$s', + '<%1$s %2$s>%3$s%4$s', + $tag_name, $wrapper_attributes, $markup, $footer_markup, diff --git a/mu-plugins/blocks/global-header-footer/src/footer/block.json b/mu-plugins/blocks/global-header-footer/src/footer/block.json index 8a11a692..07408dc9 100644 --- a/mu-plugins/blocks/global-header-footer/src/footer/block.json +++ b/mu-plugins/blocks/global-header-footer/src/footer/block.json @@ -26,7 +26,12 @@ "width": true } }, - "attributes": {}, + "attributes": { + "tagName": { + "type": "string", + "default": "footer" + } + }, "textdomain": "wporg", "style": "wporg-global-header-footer", "editorStyle": "wporg-global-header-footer",