Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/unload textdomain


Unloads translations for a domain


<?php unload_textdomain$domain ); ?>


(string) (required) Textdomain to be unloaded
Default: None

Return Values

Whether textdomain was unloaded


In case you need to prevent a text domain from unloading, the override_unload_textdomain filter is called before attempting to unload the text domain.

add_filter( 'override_unload_textdomain', 'myplugin_override_unload_textdomain' );
function myplugin_override_unload_textdomain( $override, $domain ) {
	if ( $domain === 'my-domain' ) {
		// Prevents WordPress from unloading this text domain
		$override = true;
	return $override;

Immediately before unloading a text domain, the unload_textdomain action is called to notify WordPress that the text domain is being unloaded.

add_action( 'unload_textdomain', 'myplugin_unload_textdomain' );
function myplugin_unload_textdomain( $domain ) {
	// add code here to handle the unloading the text domain

Change Log

Since: 3.0

Source File

unload_textdomain() is located in wp-includes/l10n.php