Filter hook 'gettext_with_context_{$domain}'

in WP Core File wp-includes/l10n.php at line 289

View Source

gettext_with_context_{$domain}

Filter Hook
Description
Filters text with its translation based on context information for a domain. The dynamic portion of the hook name, `$domain`, refers to the text domain.

Hook Information

File Location wp-includes/l10n.php View on GitHub
Hook Type Filter
Line Number 289

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_{$domain}
add_filter('gettext_with_context_{$domain}', '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:289 - How this hook is used in WordPress core
<?php
 284  	 * @param string $translation Translated text.
 285  	 * @param string $text        Text to translate.
 286  	 * @param string $context     Context information for the translators.
 287  	 * @param string $domain      Text domain. Unique identifier for retrieving translated strings.
 288  	 */
 289  	$translation = apply_filters( "gettext_with_context_{$domain}", $translation, $text, $context, $domain );
 290  
 291  	return $translation;
 292  }
 293  
 294  /**

PHP Documentation

<?php
/**
	 * Filters text with its translation based on context information for a domain.
	 *
	 * The dynamic portion of the hook name, `$domain`, refers to the text domain.
	 *
	 * @since 5.5.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.