APIActive

WordPress Icon Registration API

Public API in WordPress 7.1 for registering custom icon collections and icons.

Open source page

Field note

What it does

Lets plugins and themes register custom icon collections and individual SVG icons via wp_register_icon_collection() and wp_register_icon(), surfaced in the Icon block library.

Capabilities

Available capabilities

Tags

Tags

Ways to use it

Ways to use it

other

Not filed / Not filed

Product features

Product features

A quick overview of the registration functions

An example collection and icon

Building an icon registration plugin

Bundling icons in plugin

Defining the icon data structure

Hands-on with the WordPress 7.1 Icon Registration API

How to register icons

Icon block integration

Registered icons appear in the Icon Library and can be inserted via the Icon block.

Icon block library

Registered collections appear as tabs in the Icon block's Icon Library.

Load the plugin files and bootstrap

Outputting icons

Plugin setup

Registering the icons with WordPress

The missing pieces: what you can’t yet do

wp_register_icon()

Registers an icon in a collection using inline SVG content or a file path.

wp_register_icon_collection()

Registers a custom icon collection with a slug, label and description.