diff --git a/src/wp-includes/kses.php b/src/wp-includes/kses.php index 6a579b8d91..2c0e075ff4 100644 --- a/src/wp-includes/kses.php +++ b/src/wp-includes/kses.php @@ -230,6 +230,7 @@ if ( ! CUSTOM_TAGS ) { 'border' => true, 'height' => true, 'hspace' => true, + 'loading' => true, 'longdesc' => true, 'vspace' => true, 'src' => true, diff --git a/tests/phpunit/tests/kses.php b/tests/phpunit/tests/kses.php index 69870a7033..2c5a6c6706 100644 --- a/tests/phpunit/tests/kses.php +++ b/tests/phpunit/tests/kses.php @@ -765,6 +765,11 @@ EOF; 'src="mypic.jpg"', 'src="mypic.jpg"', ), + array( + 'img', + 'loading="lazy"', + 'loading="lazy"', + ), array( 'img', 'onerror=alert(1)', @@ -1352,4 +1357,26 @@ EOF; ), ); } + + /** + * Test filtering a standard img tag. + * + * @ticket 50731 + */ + function test_wp_kses_img_tag_standard_attributes() { + $html = array( + '', + ); + + $html = implode( ' ', $html ); + + $this->assertSame( $html, wp_kses_post( $html ) ); + } }