render_block_core_block

Advertisement

Summery Summery

Renders the core/block block on server.

Syntax Syntax

render_block_core_block( array $attributes )

Parameters Parameters

$attributes

(Required) The block attributes.

Return Return

(string) Rendered HTML of the referenced block.

Source Source

File: wp-includes/blocks/block.php

function render_block_core_block( $attributes ) {
	if ( empty( $attributes['ref'] ) ) {
		return '';
	}

	$reusable_block = get_post( $attributes['ref'] );
	if ( ! $reusable_block || 'wp_block' !== $reusable_block->post_type ) {
		return '';
	}

	if ( 'publish' !== $reusable_block->post_status || ! empty( $reusable_block->post_password ) ) {
		return '';
	}

	return do_blocks( $reusable_block->post_content );
}

Advertisement

Advertisement

Leave a Reply