From 84eee38fcb4114595f1cc6b751868c5649cbc1e6 Mon Sep 17 00:00:00 2001 From: Aaron Jorbin Date: Tue, 25 May 2021 01:42:20 +0000 Subject: [PATCH] Formatting: Add 'main' tag to kses `main` is a valid HTML element that is especially valuable for KSES to support in light of full site editing. Related: https://github.com/WordPress/gutenberg/pull/28576 for the addition of `main` to the group block. Fixes #53156. Props glendaviesnz. git-svn-id: https://develop.svn.wordpress.org/trunk@50987 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/kses.php | 6 ++++++ tests/phpunit/tests/kses.php | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/wp-includes/kses.php b/src/wp-includes/kses.php index a996b86a91..5310f0caf9 100644 --- a/src/wp-includes/kses.php +++ b/src/wp-includes/kses.php @@ -252,6 +252,12 @@ if ( ! CUSTOM_TAGS ) { 'align' => true, 'value' => true, ), + 'main' => array( + 'align' => true, + 'dir' => true, + 'lang' => true, + 'xml:lang' => true, + ), 'map' => array( 'name' => true, ), diff --git a/tests/phpunit/tests/kses.php b/tests/phpunit/tests/kses.php index a620d491f7..1d5dfdff60 100644 --- a/tests/phpunit/tests/kses.php +++ b/tests/phpunit/tests/kses.php @@ -1478,4 +1478,22 @@ EOF; $this->assertSame( $html, wp_kses_post( $html ) ); } + + /** + * Test filtering a standard main tag. + * + * @ticket 53156 + */ + function test_wp_kses_main_tag_standard_attributes() { + $test = array( + '', + ); + + $html = implode( ' ', $test ); + + $this->assertSame( $html, wp_kses_post( $html ) ); + } }