gettext_with_context
Filter HookDescription
Filters text with its translation based on context information.Hook Information
File Location |
wp-includes/l10n.php
View on GitHub
|
Hook Type | Filter |
Line Number | 275 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$translation
|
Translated text. |
string
|
$text
|
Text to translate. |
string
|
$context
|
Context information for the translators. |
string
|
$domain
|
Text domain. Unique identifier for retrieving translated strings. |
Usage Examples
Basic Usage
<?php
// Hook into gettext_with_context
add_filter('gettext_with_context', 'my_custom_filter', 10, 4);
function my_custom_filter($translation, $text, $context, $domain) {
// Your custom filtering logic here
return $translation;
}
Source Code Context
wp-includes/l10n.php:275
- How this hook is used in WordPress core
<?php
270 * @param string $translation Translated text.
271 * @param string $text Text to translate.
272 * @param string $context Context information for the translators.
273 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
274 */
275 $translation = apply_filters( 'gettext_with_context', $translation, $text, $context, $domain );
276
277 /**
278 * Filters text with its translation based on context information for a domain.
279 *
280 * The dynamic portion of the hook name, `$domain`, refers to the text domain.
PHP Documentation
<?php
/**
* Filters text with its translation based on context information.
*
* @since 2.8.0
*
* @param string $translation Translated text.
* @param string $text Text to translate.
* @param string $context Context information for the translators.
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
*/
Quick Info
- Hook Type: Filter
- Parameters: 4
- File: wp-includes/l10n.php
Related Hooks
Related hooks will be displayed here in future updates.