Created
May 3, 2019 20:28
-
-
Save yanknudtskov/15e8c785b4ec6d5c08751d580c15a4df to your computer and use it in GitHub Desktop.
Overriding specific language/translations in WordPress
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 | |
add_filter( 'gettext', 'yanco_filter_gettext', 10, 3 ); | |
function yanco_filter_gettext( $translated, $original, $domain ) { | |
// Use the text string exactly as it is in the translation file | |
if ( $translated == '' ) { | |
$translated = ''; | |
} | |
return $translated; | |
} | |
add_filter( 'gettext_with_context', 'yanco_filter_gettext_with_context', 10, 4 ); | |
function yanco_filter_gettext_with_context( $translated, $original, $context, $domain ) { | |
// Use the text string exactly as it is in the translation file | |
if ( $translated == '' ) { | |
$translated = ''; | |
} | |
return $translated; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment