Uma área de pesquisa sobre o WordPress para devs e autores do tema



render_block_core_block ›

Desden/a
Obsoleton/a
render_block_core_block ( $attributes )
Parâmetros:
  • (array) $attributes The block attributes.
    Required: Yes
Retorna:
  • (string) Rendered HTML of the referenced block.
Definido em:
Codex:

Renders the `core/block` block on server.



Fonte

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