Formatting: Filter out the bullet character in sanitize_title_with_dashes().

Props roytanck, deepaklalwani, veromary.
Fixes #49791.

git-svn-id: https://develop.svn.wordpress.org/trunk@48593 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-07-24 00:01:32 +00:00
parent 1ef40b14cd
commit f2d98192de
2 changed files with 9 additions and 0 deletions

View File

@ -2263,6 +2263,8 @@ function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'displa
'%e2%80%9b',
'%e2%80%9e',
'%e2%80%9f',
// Bullet.
'%e2%80%a2',
// &copy, &reg, &deg, &hellip, and &trade.
'%c2%a9',
'%c2%ae',

View File

@ -101,6 +101,13 @@ class Tests_Formatting_SanitizeTitleWithDashes extends WP_UnitTestCase {
$this->assertEquals( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its „Curly Joe‟', '', 'save' ) );
}
/**
* @ticket 49791
*/
function test_replaces_bullet() {
$this->assertEquals( 'fancy-title-amazing', sanitize_title_with_dashes( 'Fancy Title • Amazing', '', 'save' ) );
}
function test_replaces_copy_reg_deg_trade() {
$this->assertEquals( 'just-a-slug', sanitize_title_with_dashes( 'Just © a Slug', '', 'save' ) );
$this->assertEquals( 'just-a-slug', sanitize_title_with_dashes( '® Just a Slug', '', 'save' ) );