Make WordPress Core


Ignore:
Timestamp:
10/25/2025 06:22:07 PM (5 months ago)
Author:
westonruter
Message:

Formatting: Replace non-breaking hyphens (U+2011) with hyphens in sanitize_title_with_dashes().

Developed in https://github.com/WordPress/wordpress-develop/pull/10204

Follow-up to [18705], [36775].

Props patpiwo, westonruter, dmsnell.
See #31790, #10797.
Fixes #64089.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r61053 r61061  
    22952295
    22962296    if ( 'save' === $context ) {
    2297         // Convert &nbsp, &ndash, and &mdash to hyphens.
    2298         $title = str_replace( array( '%c2%a0', '%e2%80%93', '%e2%80%94' ), '-', $title );
    2299         // Convert &nbsp, &ndash, and &mdash HTML entities to hyphens.
    2300         $title = str_replace( array( ' ', ' ', '–', '–', '—', '—' ), '-', $title );
     2297        // Convert &nbsp, non-breaking hyphen, &ndash, and &mdash to hyphens.
     2298        $title = str_replace( array( '%c2%a0', '%e2%80%91', '%e2%80%93', '%e2%80%94' ), '-', $title );
     2299        // Convert &nbsp, non-breaking hyphen, &ndash, and &mdash HTML entities to hyphens.
     2300        $title = str_replace( array( ' ', '‑', ' ', '–', '–', '—', '—' ), '-', $title );
    23012301        // Convert forward slash to hyphen.
    23022302        $title = str_replace( '/', '-', $title );
Note: See TracChangeset for help on using the changeset viewer.