WordPress开发者和主题制作者的搜索引擎



render_block_core_block ›

Sincen/a
已弃用n/a
render_block_core_block ( $attributes )
参数:
  • (array) $attributes The block attributes.
    Required: Yes
返回:
  • (string) Rendered HTML of the referenced block.
定义在:
文档:

Renders the `core/block` block on server.



源码

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