The Icon Block plugin registers a single, easy-to-use block that allows you to add custom SVG icons and graphics to the WordPress block editor (Gutenberg). The plugin also includes the complete WordPress icon library with 290+ SVG icons.
- 290+ native WordPress icons, including social logos
- Use any custom SVG icon or graphic
- Insert icons from your Media Library if SVG uploads are supported
- Includes handy icon controls (link, rotate, alignment, colors, border, padding, margin, etc.)
- Fully compatible with the Site Editor
- No block library required 🎉
- Built almost entirely with native WordPress components
- Will get additional functionality as it's added to WordPress core
- Register your own custom icon library. Learn more.
The Icon Block includes several extensibility features that allow you to tailor the block to meet your needs.
Filters all icons available in the built-in icon library. Use this filter to add or remove icons from the plugin. Learn more.
Defaults to true
, this filter allows you to enable or disable custom SVG icon functionality. When disabled, you are restricted from using the icon library.
wp.hooks.addFilter(
'iconBlock.enableCustomIcons',
'example-theme/disable-custom-icons',
() => false
);
You can easily disable border and spacing settings in the Editor UI if your theme includes a theme.json file.
{
...
"settings": {
...
"blocks": {
"outermost/icon-block": {
"border": {
"color": false,
"radius": false,
"style": false,
"width": false
},
"spacing": {
"margin": false,
"padding": false
}
},
...
- WordPress 6.5+
- PHP 7.4+
- Set up a local WordPress development environment.
- Clone / download this repository into the
wp-content/plugins
folder. - Navigate to the
wp-content/plugins/icon-block
folder in the command line. - Run
npm install
to install the plugin's dependencies within a/node_modules/
folder. - Run
composer install
to install the additional WordPress composer tools within a/vendor/
folder. - Run
npm run start
to compile and watch source files for changes while developing.
Refer to package.json
for additional commands.