gettext
Filter HookDescription
Filters text with its translation.Hook Information
File Location |
wp-includes/l10n.php
View on GitHub
|
Hook Type | Filter |
Line Number | 207 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$translation
|
Translated text. |
string
|
$text
|
Text to translate. |
string
|
$domain
|
Text domain. Unique identifier for retrieving translated strings. |
Usage Examples
Basic Usage
<?php
// Hook into gettext
add_filter('gettext', 'my_custom_filter', 10, 3);
function my_custom_filter($translation, $text, $domain) {
// Your custom filtering logic here
return $translation;
}
Source Code Context
wp-includes/l10n.php:207
- How this hook is used in WordPress core
<?php
202 *
203 * @param string $translation Translated text.
204 * @param string $text Text to translate.
205 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
206 */
207 $translation = apply_filters( 'gettext', $translation, $text, $domain );
208
209 /**
210 * Filters text with its translation for a domain.
211 *
212 * The dynamic portion of the hook name, `$domain`, refers to the text domain.
PHP Documentation
<?php
/**
* Filters text with its translation.
*
* @since 2.0.11
*
* @param string $translation Translated text.
* @param string $text Text to translate.
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/l10n.php
Related Hooks
Related hooks will be displayed here in future updates.