WP_REST_Site_Health_Controller::load_admin_textdomain
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().
Method of the class: WP_REST_Site_Health_Controller{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->load_admin_textdomain();
Changelog
| Since 5.6.0 | Introduced. |
WP_REST_Site_Health_Controller::load_admin_textdomain() WP REST Site Health Controller::load admin textdomain code WP 7.0
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 );
}
}