WP_Translation_Controller::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

public function has_translation( string $singular, string $textdomain = 'default', ?string $locale = null ): bool {
	if ( null === $locale ) {
		$locale = $this->current_locale;
	}

	return false !== $this->locate_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.