WP_Translation_Controller::unload_textdomain()
Unloads all translation files for a given text domain.
Метод класса: WP_Translation_Controller{}
Хуков нет.
Возвращает
true|false
. True on success, false otherwise.
Использование
$WP_Translation_Controller = new WP_Translation_Controller(); $WP_Translation_Controller->unload_textdomain( $textdomain, ?string $locale ): bool;
- $textdomain(строка)
- Text domain.
По умолчанию: 'default' - ?string $locale **
- -
По умолчанию: null
Список изменений
С версии 6.5.0 | Введена. |
Код WP_Translation_Controller::unload_textdomain() WP Translation Controller::unload textdomain WP 6.6.2
public function unload_textdomain( string $textdomain = 'default', ?string $locale = null ): bool { $unloaded = false; if ( null !== $locale ) { if ( isset( $this->loaded_translations[ $locale ][ $textdomain ] ) ) { $unloaded = true; foreach ( $this->loaded_translations[ $locale ][ $textdomain ] as $moe ) { unset( $this->loaded_files[ $moe->get_file() ][ $locale ][ $textdomain ] ); } } unset( $this->loaded_translations[ $locale ][ $textdomain ] ); return $unloaded; } foreach ( $this->loaded_translations as $l => $domains ) { if ( ! isset( $domains[ $textdomain ] ) ) { continue; } $unloaded = true; foreach ( $domains[ $textdomain ] as $moe ) { unset( $this->loaded_files[ $moe->get_file() ][ $l ][ $textdomain ] ); } unset( $this->loaded_translations[ $l ][ $textdomain ] ); } return $unloaded; }