WPDev.one
Core Function
View Source on Trac ↗

has_translation()

has_translation( string $singular, string $textdomain = 'default', ?string $locale = null )

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

Parameters 1 required

Name / Type Description
$singular
string

Singular translation to check.

Required
$textdomain
string

Optional. Text domain. Default 'default'.

$locale
?string

Optional. Locale. Default current locale.

Return Value

(bool)
True if the translation exists, false otherwise.

Function Information

Since Version
6.7.0
Source File
wp-includes/l10n.php
Advertisement