This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Remove and copy over default sanitize_title_with_dashes functionality and add dot as allowed character | |
remove_filter( "sanitize_title", "sanitize_title_with_dashes", 10 ); | |
add_filter( "sanitize_title", function($title, $raw_title = "", $context = "display") { | |
$title = strip_tags($title); | |
// Preserve escaped octets. | |
$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title); | |
// Remove percent signs that are not part of an octet. | |
$title = str_replace('%', '', $title); |