Skip to content

Instantly share code, notes, and snippets.

@sabernhardt
Created April 10, 2025 03:04
Show Gist options
  • Select an option

  • Save sabernhardt/6d61e342dd151b5dfd9606e770721d8e to your computer and use it in GitHub Desktop.

Select an option

Save sabernhardt/6d61e342dd151b5dfd9606e770721d8e to your computer and use it in GitHub Desktop.
undo_wptexturize_en_dash_replacement
<?php
/**
* @param string $translated
* @param string $text
* @param string $context
* @param string $domain
* @return string
*/
function undo_wptexturize_en_dash_replacement( $translated, $text, $context, $domain ) {
if ( 'default' === $domain ) {
if ( '&#8211;' === $text && 'en dash' === $context ) {
$translated = '--';
}
}
return $translated;
}
add_filter( 'gettext_with_context', 'undo_wptexturize_en_dash_replacement', 10, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment