Action hook 'unload_textdomain'

in WP Core File wp-includes/l10n.php at line 913

View Source

unload_textdomain

Action Hook
Description
Fires before the text domain is unloaded.

Hook Information

File Location wp-includes/l10n.php View on GitHub
Hook Type Action
Line Number 913

Hook Parameters

Type Name Description
string $domain Text domain. Unique identifier for retrieving translated strings.
bool $reloadable Whether the text domain can be loaded just-in-time again.

Usage Examples

Basic Usage
<?php
// Hook into unload_textdomain
add_action('unload_textdomain', 'my_custom_function', 10, 2);

function my_custom_function($domain, $reloadable) {
    // Your custom code here
}

Source Code Context

wp-includes/l10n.php:913 - How this hook is used in WordPress core
<?php
 908  	 * @since 6.1.0 Added the `$reloadable` parameter.
 909  	 *
 910  	 * @param string $domain     Text domain. Unique identifier for retrieving translated strings.
 911  	 * @param bool   $reloadable Whether the text domain can be loaded just-in-time again.
 912  	 */
 913  	do_action( 'unload_textdomain', $domain, $reloadable );
 914  
 915  	// Since multiple locales are supported, reloadable text domains don't actually need to be unloaded.
 916  	if ( ! $reloadable ) {
 917  		WP_Translation_Controller::get_instance()->unload_textdomain( $domain );
 918  	}

PHP Documentation

<?php
/**
	 * Fires before the text domain is unloaded.
	 *
	 * @since 3.0.0
	 * @since 6.1.0 Added the `$reloadable` parameter.
	 *
	 * @param string $domain     Text domain. Unique identifier for retrieving translated strings.
	 * @param bool   $reloadable Whether the text domain can be loaded just-in-time again.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 2
  • File: wp-includes/l10n.php
Related Hooks

Related hooks will be displayed here in future updates.