WP_REST_Site_Health_Controller::load_admin_textdomain()protectedWP 5.6.0

Loads the admin textdomain for Site Health tests.

The WP_Site_Health{} class is defined in WP-Admin, while the REST API operates in a front-end context. This means that the translations for Site Health won't be loaded by default in load_default_textdomain().

Метод класса: WP_REST_Site_Health_Controller{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->load_admin_textdomain();

Список изменений

С версии 5.6.0 Введена.

Код WP_REST_Site_Health_Controller::load_admin_textdomain() WP 6.5.2

protected function load_admin_textdomain() {
	// Accounts for inner REST API requests in the admin.
	if ( ! is_admin() ) {
		$locale = determine_locale();
		load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo", $locale );
	}
}