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.
anchor:truealign:truespacing:margin:truepadding:true
color:interactivity:true
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
- block.json (reference)
- Source directory — browse
edit.js,save.js,index.php, and more.