Created
April 10, 2025 03:04
-
-
Save sabernhardt/6d61e342dd151b5dfd9606e770721d8e to your computer and use it in GitHub Desktop.
undo_wptexturize_en_dash_replacement
This file contains hidden or 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 | |
| /** | |
| * @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 ( '–' === $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