функция
since 5.9.0
_add_block_template_info()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
_add_block_template_info( array $template_item ): array
Описание
Пытается добавить сведения о произвольном шаблоне к элементу шаблона.
Параметры
$template_item
array
обязательный
Шаблон, к которому добавляются сведения (требуется поле 'slug').
Возвращаемое значение
array
Исходный код
wp-includes/block-template-utils.php:488
function _add_block_template_info( $template_item ) {
if ( ! wp_theme_has_theme_json() ) {
return $template_item;
}
$theme_data = wp_get_theme_data_custom_templates();
if ( isset( $theme_data[ $template_item['slug'] ] ) ) {
$template_item['title'] = $theme_data[ $template_item['slug'] ]['title'];
$template_item['postTypes'] = $theme_data[ $template_item['slug'] ]['postTypes'];
}
return $template_item;
}
История изменений
| Версия | Описание |
|---|---|
| 5.9.0 | Introduced. |

