diff --git a/src/wp-includes/kses.php b/src/wp-includes/kses.php index 964ef7fd6e..18c76c5222 100644 --- a/src/wp-includes/kses.php +++ b/src/wp-includes/kses.php @@ -61,11 +61,14 @@ if ( ! CUSTOM_TAGS ) { $allowedposttags = array( 'address' => array(), 'a' => array( - 'href' => true, - 'rel' => true, - 'rev' => true, - 'name' => true, - 'target' => true, + 'href' => true, + 'rel' => true, + 'rev' => true, + 'name' => true, + 'target' => true, + 'download' => array( + 'valueless' => 'y', + ), ), 'abbr' => array(), 'acronym' => array(), diff --git a/tests/phpunit/tests/kses.php b/tests/phpunit/tests/kses.php index ae1ccd342f..b359452b88 100644 --- a/tests/phpunit/tests/kses.php +++ b/tests/phpunit/tests/kses.php @@ -37,20 +37,27 @@ class Tests_Kses extends WP_UnitTestCase { global $allowedposttags; $attributes = array( - 'class' => 'classname', - 'id' => 'id', - 'style' => 'color: red;', - 'title' => 'title', - 'href' => 'http://example.com', - 'rel' => 'related', - 'rev' => 'revision', - 'name' => 'name', - 'target' => '_blank', + 'class' => 'classname', + 'id' => 'id', + 'style' => 'color: red;', + 'title' => 'title', + 'href' => 'http://example.com', + 'rel' => 'related', + 'rev' => 'revision', + 'name' => 'name', + 'target' => '_blank', + 'download' => '', ); foreach ( $attributes as $name => $value ) { - $string = "I link this"; - $expect_string = "I link this"; + if ( $value ) { + $attr = "$name='$value'"; + $expected_attr = "$name='" . trim( $value, ';' ) . "'"; + } else { + $attr = $expected_attr = $name; + } + $string = "I link this"; + $expect_string = "I link this"; $this->assertEquals( $expect_string, wp_kses( $string, $allowedposttags ) ); } }