has_translation()
Returns a boolean to indicate whether a translation exists for a given string with optional text domain and locale.
No Hooks.
Returns
true|false. True if the translation exists, false otherwise.
Usage
has_translation( $singular, $textdomain, ?string $locale ): bool;
- $singular(string) (required)
- Singular translation to check.
- $textdomain(string)
- Text domain.
Default:'default' - ?string $locale
- .
Default:null
Changelog
| Since 6.7.0 | Introduced. |
has_translation() has translation code WP 7.0
function has_translation( string $singular, string $textdomain = 'default', ?string $locale = null ): bool {
return WP_Translation_Controller::get_instance()->has_translation( $singular, $textdomain, $locale );
}