WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

Automattic\WooCommerce\Blocks\Utils

BlockTemplateUtils::gutenberg_build_template_result_from_post() public WC 1.0

Build a unified template object based a post Object.

{} Это метод класса: BlockTemplateUtils{}

Хуков нет.

Возвращает

\WP_Block_Template|\WP_Error. Template.

Использование

$result = BlockTemplateUtils::gutenberg_build_template_result_from_post( $post );
$post(\WP_Post) (обязательный)
Template post.

Код BlockTemplateUtils::gutenberg_build_template_result_from_post() WC 6.1.0

public static function gutenberg_build_template_result_from_post( $post ) {
	$terms = get_the_terms( $post, 'wp_theme' );

	if ( is_wp_error( $terms ) ) {
		return $terms;
	}

	if ( ! $terms ) {
		return new \WP_Error( 'template_missing_theme', __( 'No theme is defined for this template.', 'woocommerce' ) );
	}

	$theme          = $terms[0]->name;
	$has_theme_file = true;

	$template                 = new \WP_Block_Template();
	$template->wp_id          = $post->ID;
	$template->id             = $theme . '//' . $post->post_name;
	$template->theme          = 'woocommerce' === $theme ? 'WooCommerce' : $theme;
	$template->content        = $post->post_content;
	$template->slug           = $post->post_name;
	$template->source         = 'custom';
	$template->type           = $post->post_type;
	$template->description    = $post->post_excerpt;
	$template->title          = $post->post_title;
	$template->status         = $post->post_status;
	$template->has_theme_file = $has_theme_file;
	$template->is_custom      = false;
	$template->post_types     = array(); // Don't appear in any Edit Post template selector dropdown.

	if ( 'wp_template_part' === $post->post_type ) {
		$type_terms = get_the_terms( $post, 'wp_template_part_area' );
		if ( ! is_wp_error( $type_terms ) && false !== $type_terms ) {
			$template->area = $type_terms[0]->name;
		}
	}

	return $template;
}