_add_block_template_part_area_info()
Attempts to add the template part's area information to the input template.
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Returns
Array. Template info.
Usage
_add_block_template_part_area_info( $template_info );
- $template_info(array) (required)
- Template to add information to (requires
'type'and'slug'fields).
Changelog
| Since 5.9.0 | Introduced. |
_add_block_template_part_area_info() add block template part area info code WP 6.9.1
function _add_block_template_part_area_info( $template_info ) {
if ( wp_theme_has_theme_json() ) {
$theme_data = wp_get_theme_data_template_parts();
}
if ( isset( $theme_data[ $template_info['slug'] ]['area'] ) ) {
$template_info['title'] = $theme_data[ $template_info['slug'] ]['title'];
$template_info['area'] = _filter_block_template_part_area( $theme_data[ $template_info['slug'] ]['area'] );
} else {
$template_info['area'] = WP_TEMPLATE_PART_AREA_UNCATEGORIZED;
}
return $template_info;
}