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.

_filter_block_template_part_area() WordPress Function

The filter_block_template_part_area() function is used to filter the content of a template part before it is output to the screen. This function takes two arguments: the first is the name of the template part, and the second is an array of data that is used to filter the content.

_filter_block_template_part_area( string $type ) #

Checks whether the input ‘area’ is a supported value.


Description

Returns the input if supported, otherwise returns the ‘uncategorized’ value.


Top ↑

Parameters

$type

(string)(Required)Template part area name.


Top ↑

Return

(string) Input if supported, else the uncategorized value.


Top ↑

Source

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

function _filter_block_template_part_area( $type ) {
	$allowed_areas = array_map(
		static function ( $item ) {
			return $item['area'];
		},
		get_allowed_block_template_part_areas()
	);
	if ( in_array( $type, $allowed_areas, true ) ) {
		return $type;
	}

	$warning_message = sprintf(
		/* translators: %1$s: Template area type, %2$s: the uncategorized template area value. */
		__( '"%1$s" is not a supported wp_template_part area value and has been added as "%2$s".' ),
		$type,
		WP_TEMPLATE_PART_AREA_UNCATEGORIZED
	);
	trigger_error( $warning_message, E_USER_NOTICE );
	return WP_TEMPLATE_PART_AREA_UNCATEGORIZED;
}


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.