bmd / enable-button-icons
Extension to add icons to Button blocks.
Package info
github.com/bob-moore/enable-button-icons
Language:TypeScript
pkg:composer/bmd/enable-button-icons
Requires (Dev)
- phpcsstandards/phpcsutils: ^1.0
- phpstan/phpstan: ^1.10
- squizlabs/php_codesniffer: ^3.7
- symfony/var-dumper: *
- szepeviktor/phpstan-wordpress: ^1.3
- wp-coding-standards/wpcs: ^3.0
- wpify/scoper: ^3.2
README
Add icons to the WordPress Button block (core/button) in both the editor and frontend.
Fork Notice
This plugin is a fork and rewrite of Nick Diego's original project: https://github.com/ndiego/enable-button-icons
This version modernizes the architecture, packaging, and update flow while keeping the plugin focused on one job: adding icons to button blocks.
Features
- Adds icon controls to
core/buttonin the block inspector. - Supports icon libraries:
- WordPress icons
- MUI icons
- Custom SVG input
- Lets you set icon position (left/right).
- Lets you set icon size per button using CSS units (for example
1em,20px,1.25rem). - Renders sanitized inline SVG on the frontend.
- Ships with GitHub-based plugin updates in the WordPress admin update UI.
Requirements
- WordPress 6.9+
- PHP 8.2+
Installation
Install as a plugin
- Download the latest release zip from GitHub releases.
- In WordPress admin, go to Plugins -> Add New Plugin -> Upload Plugin.
- Upload the zip and activate Enable Button Icons.
Install via Composer (library usage)
If you are embedding this into your own project:
composer require bmd/enable-button-icons
Then bootstrap:
use Bmd\EnableButtonIcons; $plugin = new EnableButtonIcons( plugin_dir_url( __FILE__ ), plugin_dir_path( __FILE__ ) ); $plugin->mount();
Usage
- Add a Button block.
- Open the block sidebar.
- Open the Icon panel.
- Choose an icon source (WordPress, MUI, or Custom SVG).
- Pick icon size and position.
- Save and view the post.
Updates
This plugin is distributed through GitHub releases (not WordPress.org). The plugin includes a scoped GitHub updater so WordPress can detect and apply new versions from this repository.
Changelog
0.3.1
- Added icon toggle deselection — clicking the currently selected icon removes it.
- Split editor sidebar into separate "Icon" and "Icon Styles" panels.
- Improved icon size control layout with a consistent label and grid alignment.
- Fixed null safety for custom SVG icon input field.
- Fixed block list rendering to skip when icon has no source.
- Updated
IconValueTypeScript types to allow nullable fields. - Removed unused
classnamesdependency.
0.3.0
- Forked and rewritten from the original
ndiego/enable-button-iconsproject. - Added service-based plugin architecture.
- Added scoped GitHub updater bootstrap.
- Added modern build and release packaging workflow.
- Added icon controls for WordPress, MUI, and custom SVG.
- Added frontend icon rendering with sanitization and per-button sizing/position.