Skip to content
Sign in
Attributes for Blocks icon

Attributes for Blocks

Allows to add HTML attributes to Gutenberg blocks.

Not scanned yet WordPress plugin 4k installs

Install in

No install steps yet

Follow the steps on the source page.

This plugin adds additional advanced inspector controls to Gutenberg blocks that allow to add any custom HTML attributes to the block’s front-end output. This allows you to add inline styles to fine-tune the block’s appearance, set aria attributes to improve your site’s accessibility, add data attributes to integrate with any JavaScript modules or even JavaScript DOM event attributes such as onclick, onchange or onload.

Demo

Written by Joobi from the project's own listing. See the source page

ARIAattributesblocksgutenbergstyle
2 Dec 2026
Version 1.0.16 released. Not scanned yet.

1.0.16

  • Tested with WordPress 7.2.
  • Update @wordpress/* packages.

1.0.15

  • Tweaked UI for WordPress 7.1.

1.0.14

  • Tweaked UI for WordPress 7.0.

1.0.13

  • Tested with WordPress 6.9.

1.0.12

  • Added a donate link on the plugin page – supporters get a 50% off coupon for my brand new WordPress theme.
  • Fix potential duplication when merging style attribute values.
  • Update @wordpress/* packages.
  • Tested with Gutenberg 21.7.0.

1.0.11

  • WP 6.8.

1.0.10

  • Added afb_get_attributes filter, allowing to dynamically modify attributes.

1.0.9

  • Try fix issue with current_user_can check in pre_kses when SECURE_AUTH_COOKIE isn’t defined.

1.0.8

  • Try fix issue with current_user_can check in pre_kses when WP pluggable functions aren’t loaded.

1.0.7

  • Security update: users without unfiltered_html capability can no longer add attributes. When a user without the capability updates a post all existing attributes are stripped. Issue discovered by Francesco Carlucci (CVE ID: CVE-2024-8318, CVSS Severity Score: 6.4 (Medium)). The vulnerability made it possible for authenticated attackers, with Contributor-level access and above, to inject arbitrary web scripts in pages that will execute whenever a user accessed an injected page.
  • Tested up to WordPress 6.6.
  • Update @wordpress/* packages.

1.0.6

  • Tested up to WordPress 6.5.
  • Fix PHP notice when rendering a block that doesn’t have any attributes.
  • Update @wordpress/* packages.

1.0.5

  • Use WP_HTML_Tag_Processor for adding HTML attributes.
  • Remove afb_sanitize_attribute_key and afb_sanitize_attribute_value filters (now handled by WP_HTML_Tag_Processor).
  • Use render_block filter to apply attributes instead of overriding block’s render_callback.
  • Move all PHP code to main file for simplicity.
  • Add $attribute param to afb_attribute_separator filter.
  • Remove uppercase text transform from attribute input labels, use monospace font for value.
  • Add button to edit attributes in a modal for more space.
  • Update @wordpress/* packages.
  • Regression: for blocks that render multiple root elements attributes are only applied to the first one.

1.0.4

  • Add afb_sanitize_attribute_key and afb_sanitize_attribute_value filters.
  • Catch errors when using invalid characters in attribute name/value.
  • Update @wordpress/* packages.

1.0.3

  • Update @wordpress/* packages.
  • Test with WordPress 6.0.
  • Convert advanced style attribute editor to TypeScript and refactor.
  • Fix duplicate attribute values being output when the block has both JS and PHP render functions.
  • Add GitHub link.
  • Remove src folder from plugin.

1.0.2

  • Add advanced editor for style attribute.
  • Remove jQuery.

1.0.1

  • Fix special character encoding for dynamic blocks.
25 Aug 2021Listed on Joobi from WordPress.org.

Follow this listing's changes (Atom feed)