WP_Translation_Controller::get_headers()publicWP 6.5.0

Returns all existing headers for a given text domain.

Method of the class: WP_Translation_Controller{}

No Hooks.

Return

Array. string> Headers.

Usage

$WP_Translation_Controller = new WP_Translation_Controller();
$WP_Translation_Controller->get_headers( $textdomain ): array;
$textdomain(string)
Text domain.
Default: 'default'

Changelog

Since 6.5.0 Introduced.

WP_Translation_Controller::get_headers() code WP 6.5.3

public function get_headers( string $textdomain = 'default' ): array {
	if ( array() === $this->loaded_translations ) {
		return array();
	}

	$headers = array();

	foreach ( $this->get_files( $textdomain ) as $moe ) {
		foreach ( $moe->headers() as $header => $value ) {
			$headers[ $this->normalize_header( $header ) ] = $value;
		}
	}

	return $headers;
}