Title: WP_Theme::load_textdomain
Published: April 25, 2014
Last modified: April 28, 2025

---

# WP_Theme::load_textdomain(): bool

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_theme/load_textdomain/?output_format=md#description)
 * [Return](https://developer.wordpress.org/reference/classes/wp_theme/load_textdomain/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_theme/load_textdomain/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_theme/load_textdomain/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_theme/load_textdomain/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_theme/load_textdomain/?output_format=md#wp--skip-link--target)

Loads the theme’s textdomain.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_theme/load_textdomain/?output_format=md#description)󠁿

Translation files are not inherited from the parent theme. TODO: If this fails for
the child theme, it should probably try to load the parent theme’s translations.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_theme/load_textdomain/?output_format=md#return)󠁿

 bool True if the textdomain was successfully loaded or has already been loaded.

False if no textdomain was specified in the file headers, or if the domain could
not be loaded.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_theme/load_textdomain/?output_format=md#source)󠁿

    ```php
    public function load_textdomain() {
    	if ( isset( $this->textdomain_loaded ) ) {
    		return $this->textdomain_loaded;
    	}

    	$textdomain = $this->get( 'TextDomain' );
    	if ( ! $textdomain ) {
    		$this->textdomain_loaded = false;
    		return false;
    	}

    	if ( is_textdomain_loaded( $textdomain ) ) {
    		$this->textdomain_loaded = true;
    		return true;
    	}

    	$path       = $this->get_stylesheet_directory();
    	$domainpath = $this->get( 'DomainPath' );
    	if ( $domainpath ) {
    		$path .= $domainpath;
    	} else {
    		$path .= '/languages';
    	}

    	$this->textdomain_loaded = load_theme_textdomain( $textdomain, $path );
    	return $this->textdomain_loaded;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-theme.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/class-wp-theme.php#L1511)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/class-wp-theme.php#L1511-L1537)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_theme/load_textdomain/?output_format=md#related)󠁿

| Uses | Description | 
| [is_textdomain_loaded()](https://developer.wordpress.org/reference/functions/is_textdomain_loaded/)`wp-includes/l10n.php` |

Determines whether there are translations for the text domain.

  | 
| [load_theme_textdomain()](https://developer.wordpress.org/reference/functions/load_theme_textdomain/)`wp-includes/l10n.php` |

Loads the theme’s translated strings.

  | 
| [WP_Theme::get_stylesheet_directory()](https://developer.wordpress.org/reference/classes/wp_theme/get_stylesheet_directory/)`wp-includes/class-wp-theme.php` |

Returns the absolute path to the directory of a theme’s “stylesheet” files.

  | 
| [WP_Theme::get()](https://developer.wordpress.org/reference/classes/wp_theme/get/)`wp-includes/class-wp-theme.php` |

Gets a raw, unformatted theme header.

  |

| Used by | Description | 
| [WP_Theme::get_post_templates()](https://developer.wordpress.org/reference/classes/wp_theme/get_post_templates/)`wp-includes/class-wp-theme.php` |

Returns the theme’s post templates.

  | 
| [WP_Theme::display()](https://developer.wordpress.org/reference/classes/wp_theme/display/)`wp-includes/class-wp-theme.php` |

Gets a theme header, formatted and translated for display.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_theme/load_textdomain/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_theme%2Fload_textdomain%2F)
before being able to contribute a note or feedback.