_add_block_template_part_area_info

The timeline below displays how wordpress function _add_block_template_part_area_info has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.4

/**
 * Attempts to add the template part's area information to the input template.
 *
 * @since 5.9.0
 * @access private
 *
 * @param array $template_info Template to add information to (requires 'type' and 'slug' fields).
 * @return array Template info.
 */
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;
}

WordPress Version: 6.2

/**
 * Attempts to add the template part's area information to the input template.
 *
 * @since 5.9.0
 * @access private
 *
 * @param array $template_info Template to add information to (requires 'type' and 'slug' fields).
 * @return array Template info.
 */
function _add_block_template_part_area_info($template_info)
{
    if (wp_theme_has_theme_json()) {
        $theme_data = WP_Theme_JSON_Resolver::get_theme_data(array(), array('with_supports' => false))->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;
}

WordPress Version: 6.1

/**
 * Attempts to add the template part's area information to the input template.
 *
 * @since 5.9.0
 * @access private
 *
 * @param array $template_info Template to add information to (requires 'type' and 'slug' fields).
 * @return array Template info.
 */
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;
}

WordPress Version: 5.9

/**
 * Attempts to add the template part's area information to the input template.
 *
 * @since 5.9.0
 * @access private
 *
 * @param array $template_info Template to add information to (requires 'type' and 'slug' fields).
 *
 * @return array Template info.
 */
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;
}