gettext
Filters text with its translation.
Usage
add_filter( 'gettext', 'wp_kama_gettext_filter', 10, 3 );
/**
* Function for `gettext` filter-hook.
*
* @param string $translation Translated text.
* @param string $text Text to translate.
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
*
* @return string
*/
function wp_kama_gettext_filter( $translation, $text, $domain ){
// filter...
return $translation;
}
- $translation(string)
- Translated text.
- $text(string)
- Text to translate.
- $domain(string)
- Text domain. Unique identifier for retrieving translated strings.
Changelog
| Since 2.0.11 | Introduced. |
Where the hook is called
gettext
wp-includes/l10n.php 207
$translation = apply_filters( 'gettext', $translation, $text, $domain );