parse_blocks

函数
parse_blocks ( $content )
参数
  • (string) $content Post content.
    Required:
返回值
  • (array[]) Array of parsed block objects.
定义位置
相关方法
has_blockshas_block_flatten_blocksrender_blockdo_blocks
引入
5.0.0
弃用
-

parse_blocks: 这个函数将给定内容字符串中的块解析为一个块对象的列表。它需要一个参数:$content(字符串),表示要解析的内容。

从内容字符串中解析出块。

function parse_blocks( $content ) {
	/**
	 * Filter to allow plugins to replace the server-side block parser.
	 *
	 * @since 5.0.0
	 *
	 * @param string $parser_class Name of block parser class.
	 */
	$parser_class = apply_filters( 'block_parser_class', 'WP_Block_Parser' );

	$parser = new $parser_class();
	return $parser->parse( $content );
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-05 16:32:56

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: