wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_render_empty_block_template_warning › WordPress Function

Since6.8.0
Deprecatedn/a
wp_render_empty_block_template_warning ( $block_template )
Parameters:
  • (WP_Block_Template) $block_template The block template object.
    Required: Yes
Returns:
  • (string) The warning screen HTML.
Defined at:
Codex:

Renders a warning screen for empty block templates.



Source

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' )
	);
}