has_translation( string $singular, string $textdomain, ?string $locale = null ): bool

In this article

Returns a boolean to indicate whether a translation exists for a given string with optional text domain and locale.

Parameters

$singularstringrequired
Singular translation to check.
$textdomainstringoptional
Text domain. Default 'default'.
$locale?stringoptional
Locale. Default current locale.

Default:null

Return

bool True if the translation exists, false otherwise.

Source

function has_translation( string $singular, string $textdomain = 'default', ?string $locale = null ): bool {
	return WP_Translation_Controller::get_instance()->has_translation( $singular, $textdomain, $locale );
}

Changelog

VersionDescription
6.7.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.