Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#18170 closed defect (bug) (duplicate)

sanitize_title_with_dashes() don't strip out some special punctuation

Reported by: husobj Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Permalinks Keywords:
Focuses: Cc:


Found an issue where sanitize_title_with_dashes() doesn't strip out some 'special' punctuation.

In my example it wasn't stripping out long or em-dashes.

The em-dash got in there by copying and pasting from elsewhere and may happen frequently.

This didn't cause an issue directly in the browser as that was able to handle a long dash OK, but in using the permalink in another scenario it came through as encoded characters which messed up the link.

I could possible filter the encoding out before using it, but it would be better and safer if em-dashes got replaced by the sanitize_title_with_dashes() function (and sanitize_title if that doesn't already).

The other knock-on effect was that if there is an em-dash you end up with loads of hyphens in the slug.

For example: "Biography - About Me" (with an em-dash not a hyphen)

Becomes: "biography---about-me" (where the middle hyphen is actually an em-dash)

If your title uses a hyphen rather than em-dash it collapses fine: "biography-about-me"

Change History (3)

#1 @kawauso
7 years ago

  • Keywords needs-patch added

#2 @SergeyBiryukov
7 years ago

  • Keywords needs-patch removed
  • Resolution set to duplicate
  • Status changed from new to closed

#3 @kawauso
7 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.