wp_render_empty_block_template_warning()WP 6.8.0

Renders a warning screen for empty block templates.

Хуков нет.

Возвращает

Строку. The warning screen HTML.

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

wp_render_empty_block_template_warning( $block_template );
$block_template(WP_Block_Template) (обязательный)
The block template object.

Список изменений

С версии 6.8.0 Введена.

Код wp_render_empty_block_template_warning() WP 6.8.1

function wp_render_empty_block_template_warning( $block_template ) {
	wp_enqueue_style( 'wp-empty-template-alert' );
	return sprintf(
		/* translators: %1$s: Block template title. %2$s: Empty template warning message. %3$s: Edit template link. %4$s: Edit template button label. */
		'<div id="wp-empty-template-alert">
			<h2>%1$s</h2>
			<p>%2$s</p>
			<a href="%3$s" class="wp-element-button">
				%4$s
			</a>
		</div>',
		esc_html( $block_template->title ),
		__( 'This page is blank because the template is empty. You can reset or customize it in the Site Editor.' ),
		get_edit_post_link( $block_template->wp_id, 'site-editor' ),
		__( 'Edit template' )
	);
}