添加一个显示从其他网站(如 Twitter 或 YouTube)拉取内容的块。

  • 名称: core/embed
  • 类别: 嵌入
  • API 版本: 3
  • 块类型: 静态(保存在文章内容中)

属性

通过 attributes 属性在 block.json 中定义。

属性类型默认值描述
urlstring—角色:content
captionrich-text—来源:rich-text。 选择器:figcaption。 角色:content
typestring—角色:content
providerNameSlugstring—角色:content
allowResponsivebooleantrue—
responsivebooleanfalse角色:content
previewablebooleantrue角色:content

支持

通过 supports 属性在 block.json 中定义。

块标记

这是一个 静态块。标记直接保存在文章内容中。

<!-- wp:embed {"url":"https://example.com/"} -->
<figure class="wp-block-embed">
    <div class="wp-block-embed__wrapper">
        https://example.com/
    </div>
    <figcaption class="wp-element-caption">来自示例 URL 的嵌入内容</figcaption>
</figure>
<!-- /wp:embed -->

来源