unload_textdomain

Unload translations for a text domain.

Description

unload_textdomain( (string) $domain ); 

Parameters (1)

0. $domain (string)
Text domain. Unique identifier for retrieving translated strings.

Usage

  1. if ( !function_exists( 'unload_textdomain' ) ) { 
  2. require_once ABSPATH . WPINC . '/l10n.php'; 
  3.  
  4. // Text domain. Unique identifier for retrieving translated strings. 
  5. $domain = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = unload_textdomain($domain); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/l10n.php  
  1. function unload_textdomain( $domain ) { 
  2. global $l10n, $l10n_unloaded; 
  3.  
  4. $l10n_unloaded = (array) $l10n_unloaded; 
  5.  
  6. /** 
  7. * Filters whether to override the text domain unloading. 
  8. * @since 3.0.0 
  9. * @param bool $override Whether to override the text domain unloading. Default false. 
  10. * @param string $domain Text domain. Unique identifier for retrieving translated strings. 
  11. */ 
  12. $plugin_override = apply_filters( 'override_unload_textdomain', false, $domain ); 
  13.  
  14. if ( $plugin_override ) { 
  15. $l10n_unloaded[ $domain ] = true; 
  16.  
  17. return true; 
  18.  
  19. /** 
  20. * Fires before the text domain is unloaded. 
  21. * @since 3.0.0 
  22. * @param string $domain Text domain. Unique identifier for retrieving translated strings. 
  23. */ 
  24.  
  25. if ( isset( $l10n[$domain] ) ) { 
  26. unset( $l10n[$domain] ); 
  27.  
  28. $l10n_unloaded[ $domain ] = true; 
  29.  
  30. return true; 
  31.  
  32. return false;