[WordPress] 外掛分享: Block Data Attribute

首頁外掛目錄 › Block Data Attribute
WordPress 外掛 Block Data Attribute 的封面圖片
300+
安裝啟用
★★★★★
5/5 分(4 則評價)
7 天前
最後更新
問題解決
WordPress 6.0+ PHP 7.4+ v2.1.0 上架:2020-02-09

內容簡介

此外掛的設計考慮到擴充性,用於與特定區塊類型相關聯的資料,但不需要定義其含義。 data-* 屬性可以讓您在不使用其他駭客技巧(如非標準屬性、在 DOM 上附加屬性或修改區塊為 HTML)的情況下,在不同的 Gutenberg 區塊上儲存額外資訊,進而避免在重新開啟文章編輯頁面時造成區塊驗證錯誤。

外掛標籤

開發者團隊

⬇ 下載最新版 (v2.1.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Block Data Attribute」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Block Data Attribute lets you attach custom data-* attributes to core WordPress blocks straight from the block settings sidebar. No theme edits, no custom code, no block validation errors.
data-* attributes are a standard HTML mechanism for storing extra information on elements. They are widely used for JavaScript interactions, CSS targeting, analytics tagging, accessibility enhancements, and third-party integrations. This plugin brings that capability into the block editor in a clean, structured way.
Key Features

Add any number of data-* attributes to supported blocks.
Name and value fields with input sanitisation built in.
Drag-and-drop reordering of attributes within the sidebar panel.
Attributes are saved directly in block markup — no post meta, no database overhead.
Fully extensible: register additional allowed block types via a JavaScript filter.
No build step required — ships as a single plain JavaScript file.
Translation-ready.

Supported Blocks
Out of the box the following core blocks support custom data attributes:

core/button
core/column
core/columns
core/group
core/heading
core/paragraph

文章
Filter
Apply Filters
Mastodon