WordPress at a glance

unload_textdomain() WP 1.0

Unload translations for a text domain.

  • Global. Array. $l10n An array of all currently loaded text domains.
  • Global. Array. $l10n_unloaded An array of all text domains that have been unloaded again.
Hooks from function:
Return

true/false. Whether textdomain was unloaded.

Usage

unload_textdomain( $domain );
$domain(string) (required)
Text domain. Unique identifier for retrieving translated strings.

Code of unload_textdomain: wp-includes/l10n.php VER 4.9.8

<?php
function unload_textdomain( $domain ) {
	global $l10n, $l10n_unloaded;

	$l10n_unloaded = (array) $l10n_unloaded;

	/**
	 * Filters whether to override the text domain unloading.
	 *
	 * @since 3.0.0
	 *
	 * @param bool   $override Whether to override the text domain unloading. Default false.
	 * @param string $domain   Text domain. Unique identifier for retrieving translated strings.
	 */
	$plugin_override = apply_filters( 'override_unload_textdomain', false, $domain );

	if ( $plugin_override ) {
		$l10n_unloaded[ $domain ] = true;

		return true;
	}

	/**
	 * Fires before the text domain is unloaded.
	 *
	 * @since 3.0.0
	 *
	 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
	 */
	do_action( 'unload_textdomain', $domain );

	if ( isset( $l10n[$domain] ) ) {
		unset( $l10n[$domain] );

		$l10n_unloaded[ $domain ] = true;

		return true;
	}

	return false;
}

Related Functions

From tag: textdomain (mo po files)

More from tag: localize (l10n i18n Internationalization localization)

More from category: Localization

No comments
    Hello, !     Log In . Register