WPThumbs
Themes Plugins By purpose By industry Best-of lists Fix it guides
Free Plugin by Mahdi v2.1.0

Block Data Attribute

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

Block Data Attribute

The facts

Rating
5★ from 4
Active installs
300+
Price
Free
Last updated
10 Jun 2026
Added
Feb 2020
Requires WP
6.0
Tested up to
WP 7.0.4
Requires PHP
7.4
Downloads
6,902

Our analysis

AI-assisted

Block Data Attribute is a WordPress plugin that allows you to attach custom data-* attributes to core WordPress blocks directly from the block settings sidebar. This functionality is useful for adding extra information to elements without needing to edit themes or write custom code.

The plugin supports various core blocks, including buttons, headings, and paragraphs, enabling users to enhance their site's interactivity and analytics capabilities. It is designed for users who want to customise their blocks without technical complexities.

Best for: This plugin suits WordPress users looking to enhance block functionality without coding.

What it does well

  • Allows adding custom data-* attributes to core blocks
  • No theme edits or custom code required
  • Supports drag-and-drop reordering of attributes
  • Attributes are saved directly in block markup
  • Translation-ready

Where it falls short

  • Limited to specific core blocks
  • No information on support or updates beyond June 2026

Verdict

Block Data Attribute provides a straightforward way to add custom attributes to WordPress blocks, making it useful for those wanting to improve their site's functionality without technical skills.

From the developer

Mahdi's own description of Block Data Attribute, lightly tidied.

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

Read the full description on the official page →

Tagged as