Title: wp_get_theme_data_template_parts
Published: November 8, 2023
Last modified: May 20, 2026

---

# wp_get_theme_data_template_parts(): array

## In this article

 * [Return](https://developer.wordpress.org/reference/functions/wp_get_theme_data_template_parts/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_get_theme_data_template_parts/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_get_theme_data_template_parts/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_get_theme_data_template_parts/?output_format=md#changelog)

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

Returns the metadata for the template parts defined by the theme.

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

 array Associative array of `$part_name => $part_data` pairs, with `$part_data` 
having "title" and "area" fields.

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

    ```php
    function wp_get_theme_data_template_parts() {
    	$cache_group    = 'theme_json';
    	$cache_key      = 'wp_get_theme_data_template_parts';
    	$can_use_cached = ! wp_is_development_mode( 'theme' );

    	if ( $can_use_cached ) {
    		$metadata = wp_cache_get( $cache_key, $cache_group );
    		if ( false !== $metadata ) {
    			return $metadata;
    		}
    	}

    	$metadata = WP_Theme_JSON_Resolver::get_theme_data( array(), array( 'with_supports' => false ) )->get_template_parts();
    	if ( $can_use_cached ) {
    		wp_cache_set( $cache_key, $metadata, $cache_group );
    	}

    	return $metadata;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/global-styles-and-settings.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/global-styles-and-settings.php#L472)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/global-styles-and-settings.php#L472-L490)

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

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

Checks whether the site is in the given development mode.

  | 
| [WP_Theme_JSON_Resolver::get_theme_data()](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/get_theme_data/)`wp-includes/class-wp-theme-json-resolver.php` |

Returns the theme’s data.

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

Saves the data to the cache.

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

Retrieves the cache contents from the cache by key and group.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/wp_get_theme_data_template_parts/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_get_theme_data_template_parts/?output_format=md#)

| Used by | Description | 
| [_add_block_template_part_area_info()](https://developer.wordpress.org/reference/functions/_add_block_template_part_area_info/)`wp-includes/block-template-utils.php` |

Attempts to add the template part’s area information to the input template.

  |

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

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

## User Contributed Notes

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