diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index f95404bffd901..f2d3aa4de3b8c 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -2709,6 +2709,10 @@ function slugify( string $sluggee ): string { * @return string The sanitized title. */ function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'display' ) { + if ( 'display' === $context ) { + return slugify( $title ); + } + $title = strip_tags( $title ); // Preserve escaped octets. $title = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title );