wordpress-develop
wordpress-develop copied to clipboard
Formatting: Convert multiplication symbol to 'x' in title slugs
Trac ticket: https://core.trac.wordpress.org/ticket/64284
This PR ensures the multiplication symbol (×) and its HTML entities are consistently replaced with the letter "x" when sanitizing titles for slugs.
Users sometimes accidentally type × (U+00D7, Multiplication Sign) instead of x (U+0078, Latin Small Letter X) in post titles. The existing code only replaced the URL-encoded form (%c3%97) after encoding, which didn't handle the character consistently in all cases.
This PR adds replacement of the multiplication character and its entities before URL encoding occurs:
- Direct character:
× - HTML entity:
× - Numeric entity:
×
The existing replacement of %c3%97 (line 2387) is retained as a fallback for already-encoded content.
Examples
| Input | Output |
|---|---|
iPhone 12 × 256GB |
iphone-12-x-256gb |
Screen 1920 × 1080 |
screen-1920-x-1080 |
6×7 is 42 |
6x7-is-42 |
Product 5×10 |
product-5x10 |