Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

_add_block_template_part_area_info() WordPress Function

The add_block_template_part_area_info() function allows you to add information about a template part to the Block Template Areas list in the Block Editor. This can be useful if you want to provide context for a template part or tell the user what content is contained in it.

_add_block_template_part_area_info( array $template_info ) #

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


Parameters

$template_info

(array)(Required)Template to add information to (requires 'type' and 'slug' fields).


Top ↑

Return

(array) Template info.


Top ↑

Source

File: wp-includes/block-template-utils.php

function _add_block_template_part_area_info( $template_info ) {
	if ( WP_Theme_JSON_Resolver::theme_has_support() ) {
		$theme_data = WP_Theme_JSON_Resolver::get_theme_data()->get_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;
}


Top ↑

Changelog

Changelog
VersionDescription
5.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.