Skip to content

Instantly share code, notes, and snippets.

View pablosfc's full-sized avatar

Pablo pablosfc

  • Argentina
View GitHub Profile
@stuartduff
stuartduff / translate.php
Last active July 17, 2022 14:34
WordPress Translate Text testing Snippet - this snippet when added to a themes functions.php file will let you test if the Localization of a word or text string is taking effect and changing within a theme or plugin without using the translation .MO and .PO files.
function translate_text( $translated ) {
// The first parameter is the original text, the second parameter is the changed text.
$translated = str_ireplace( 'Choose and option', 'Select', $translated );
// Returns the translated text
return $translated;
}
add_filter( 'gettext', 'translate_text' );