WordPress.org

Make WordPress Core

Ticket #16036: 16036.patch

File 16036.patch, 916 bytes (added by solarissmoke, 7 years ago)

Replace m- and n-dashes with normal dashes in sanitize_title_with_dashes

  • wp-includes/formatting.php

     
    818818}
    819819
    820820/**
    821  * Sanitizes title, replacing whitespace with dashes.
     821 * Sanitizes title, replacing whitespace and a few other characters with dashes.
    822822 *
    823823 * Limits the output to alphanumeric characters, underscore (_) and dash (-).
    824  * Whitespace becomes a dash.
    825824 *
    826825 * @since 1.2.0
    827826 *
     
    847846        $title = strtolower($title);
    848847        $title = preg_replace('/&.+?;/', '', $title); // kill entities
    849848        $title = str_replace('.', '-', $title);
     849        $title = str_replace( array( '%e2%80%93', '%e2%80%94' ), '-', $title ); // ndash and mdash octets
    850850        $title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
    851851        $title = preg_replace('/\s+/', '-', $title);
    852852        $title = preg_replace('|-+|', '-', $title);