File

In this article


Add a link to a downloadable file.

  • Name: core/file
  • Category: media
  • API Version: 3
  • Block Type: Hybrid (static save + server enhancements)
  • Keywords: document, pdf, download

Attributes

Defined via the attributes property in block.json.

Attribute Type Default Description
id number
blob string Role: local
href string Role: content
fileId string Source: attribute. Selector: a:not([download]). HTML attr: id
fileName rich-text Source: rich-text. Selector: a:not([download]). Role: content
textLinkHref string Source: attribute. Selector: a:not([download]). HTML attr: href. Role: content
textLinkTarget string Source: attribute. Selector: a:not([download]). HTML attr: target
showDownloadButton boolean true
downloadButtonText rich-text Source: rich-text. Selector: a[download]. Role: content
displayPreview boolean
previewHeight number 600

Supports

Defined via the supports property in block.json.

Block Markup

This is a hybrid block. It saves static markup that the server may enhance during rendering.

<!-- wp:file {"showDownloadButton":true,"previewHeight":600} -->
<!-- Content... -->
<!-- /wp:file -->

Source