Title: WP_Translation_Controller::get_headers
Published: April 3, 2024
Last modified: February 24, 2026

---

# WP_Translation_Controller::get_headers( string $textdomain ): array<string,

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_translation_controller/get_headers/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_translation_controller/get_headers/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_translation_controller/get_headers/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_translation_controller/get_headers/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_translation_controller/get_headers/?output_format=md#changelog)

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

Returns all existing headers for a given text domain.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_translation_controller/get_headers/?output_format=md#parameters)󠁿

 `$textdomain`stringoptional

Text domain. Default `'default'`.

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

 array<string, string> Headers.

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

    ```php
    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;
    }
    ```

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

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

| Uses | Description | 
| [WP_Translation_Controller::get_files()](https://developer.wordpress.org/reference/classes/wp_translation_controller/get_files/)`wp-includes/l10n/class-wp-translation-controller.php` |

Returns all translation files for a given text domain.

  | 
| [WP_Translation_Controller::normalize_header()](https://developer.wordpress.org/reference/classes/wp_translation_controller/normalize_header/)`wp-includes/l10n/class-wp-translation-controller.php` |

Normalizes header names to be capitalized.

  |

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

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

## User Contributed Notes

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