跳到内容

Block Data Attribute

v2.1.0

Mahdi Yazdani · 2020年2月10日 上架

Add custom HTML data attributes to core WordPress blocks directly from the block editor sidebar — no coding required.

正在使用
300+
评分
5.0 / 5
累计下载
7,416
最近更新
2026年6月10日
4 条评价需要 WordPress 6.0+已测试到 7.0.9PHP 7.4+

截图

Block Data Attribute panel in the block editor sidebar showing name/value pairs with drag-to-reorder handles and the Add attribute button.
Block Data Attribute panel in the block editor sidebar showing name/value pairs with drag-to-reorder handles and the Add attribute button.

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

Plums

按场景查找 WordPress 插件。安装量、评分和兼容版本来自官方目录。

导航

说明

WordPress 是 WordPress Foundation 的商标。本站与 WordPress Foundation、Automattic 没有隶属关系。这里不托管插件文件,下载和安装以 WordPress.org 上的页面为准。

© 2026 Plums