WP_Theme::load_textdomain

Advertisement

Summery Summery

Loads the theme’s textdomain.

Syntax Syntax

WP_Theme::load_textdomain()

Description 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 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 Source

File: wp-includes/class-wp-theme.php

		$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;
	}

	/**
	 * Whether the theme is allowed (multisite only).
	 *
	 * @since 3.4.0

Advertisement

Changelog Changelog

Changelog
Version Description
3.4.0 Introduced.

Advertisement

Leave a Reply