Descripció
The SVG Forge Icon Manager Block loads a central SVG sprite file (by default the bundled sprite.svg), shows all contained <symbol> elements in a convenient picker and inserts the selected icon as <svg><use href="/wp-content/plugins/sf-icon-manager/sprite.svg#symbol-id"> into your content.
The SVG sprite is a static SVG fragment file loaded by the browser via <use> — no JS on the frontend. Since you own the sprite file, every icon stays small, cacheable and fully under your control — exactly the way a hand-built icon set should be maintained.
Who is this plugin for?
This plugin is primarily aimed at advanced theme and plugin developers. It does not give you a code-free icon manager: every icon must first exist as a <symbol> in a sprite file that you own, build and version.
Since WordPress 7.1, core ships its own icon system (wp_register_icon_collection(), wp_register_icon(), wp_get_icon()): icons then automatically appear in the native Icon block’s picker and in the REST API, and can be rendered directly in PHP. If you only need a few icons and can register them in code, use core instead — this plugin is then unnecessary.
The fragment approach has advantages when you run a real sprite pipeline:
- Full SVG via
<use>: stroke-based icons, gradients,currentColor, inline styles and customviewBoxvalues survive. WordPress 7.1’s sanitizer only allows<svg>,<path>and<polygon>(nostroke, no inline styles) and therefore breaks many stroke-based icon sets. - Reuse existing sprites: generate a sprite with svgforge-cli (sanitization + svgo optimization) and upload it — no per-icon PHP code required.
- Need a sprite? Learn step by step how to build your own custom SVG icon set: Creating custom icon sets with svgforge-cli.
- One file: the sprite is a single cacheable file that lives in the theme repo and is versioned with Git.
- Cache friendly: the sprite is one static SVG file, so the browser caches it once and every icon on the whole site reuses that cached file — no per-icon HTTP requests.
- Control per block: fill and stroke colours, size (standard Dimensions panel with preset slider + custom input), links with
relhandling and aria-labels — per icon instance, without touching a stylesheet. - Also runs on WordPress versions before 7.1 (from 6.6).
Limitations you should know about:
- To add or change icons you have to rebuild the sprite file — typically with svgforge-cli, which handles sanitization and svgo optimization. There is no in-browser icon editor or management UI.
- The icons live in your content as a block. There is no replacement for the simple
wp_get_icon()helper in theme PHP — that is what the native 7.1 approach is for.
Features
- Settings page (Settings SVG Forge Icon Manager) to upload the SVG sprite file — svgforge-cli handles full sanitization and svgo optimization, the plugin strips scripts, event handlers and
javascript:links as a safety net. - Theme override via the
sfim_sprite_urlfilter (e.g.get_theme_file_uri()) – the filter has priority over everything. - Symbol picker in the editor with a live preview of all icons from the sprite; icons from sprite subdirectories (IDs like
directory--filename) are grouped and selectable via a filter in the dropdown. - Icons can be linked (new tab + rel attributes including noopener/noreferrer).
- Aria-label for screen readers; linked icons are automatically labelled via the link.
- Fill and stroke colour as well as size per block (square, preset slider + custom input with units).
- Fully dynamic server-side rendering (render.php) with
get_block_wrapper_attributes(). - Block supports: alignment, anchor, additional CSS classes.
Configure the sprite file
The SVG sprite file is resolved in this order (first existing source wins):
- Filter
sfim_sprite_url– the canonical override (has priority). - Uploaded file from Settings SVG Forge Icon Manager (backend upload).
- Fallback:
sprite.svgin the plugin directory.
Override with a filter (recommended, versionable with the theme) in the theme’s functions.php:
add_filter( 'sfim_sprite_url', fn () => get_theme_file_uri( 'assets/ico.svg' ) );
or point it at a CDN:
add_filter( 'sfim_sprite_url', fn () => 'https://cdn.example.com/icons/ico.svg' );
SVG Forge Icon Manager is a developer-focused Gutenberg block that arranges a curated set of SVG icons as one central sprite and reuses them everywhere in your content. It works with any symbol sprite produced by modern build tools, is fully translated, and gives you precise control over colours, size, links and accessibility on every single block instance. The plugin prefers simplicity and performance: no tracking, no third-party requests, no page-weight overhead, and no vendor lock-in to a particular icon pack or service.
Development
Development is done on GitHub.
Captures

Blocs
Aquesta extensió proporciona 1 bloc.
- SVG Icon Inserts an SVG icon from the plugin SVG Forge Icon Manager and can be linked.
Instal·lació
- Upload the plugin folder to
/wp-content/plugins/(or install the ZIP via Plugins Add New). - Activate the plugin under «Plugins».
- Upload the sprite file (
ico.svgwith<symbol id="...">elements) via Settings SVG Forge Icon Manager or reference your own file with thesfim_sprite_urlfilter. - In the editor, add the «SVG Icon» block and choose an icon.
PMF
-
Where do the icons come from?
-
From the central sprite file
ico.svg. Each icon is a<symbol id="my-icon" viewBox="0 0 24 24">…</symbol>element. The sprite is a static SVG fragment file that the browser loads as a regular SVG fragment. -
Why not simply use the native SVG icons of WordPress 7.1?
-
WordPress 7.1 offers a native icon system with
wp_register_icon_collection()/wp_register_icon()/wp_get_icon()— that is enough if you register a few icons directly in code. This plugin complements that where a central SVG sprite is used: full SVG freedom (including stroke icons), existing sprites without per-icon PHP code, a single cacheable file and per-instance block styling. Since 0.2 the plugin can also register every symbol of that sprite as ansf-icon-managercollection (experimental), so the same sprite feeds the native Icon block andwp_get_icon()too — see the «WordPress native icon integration» setting. -
Does it work without JS in the frontend?
-
Yes. The frontend markup is generated server-side in
render.php; the built JS is only needed in the editor. -
How do I disable the color options for the block?
-
Put the block’s color settings into your theme’s
theme.json:{ "version": 3, "settings": { "blocks": { "sf-icon-manager/svg-icon": { "color": { "custom": false, "palette": [] } } } } }That removes the standard Gutenberg Color/Background panels for the SVG Icon block. As in the core Icon block, multi-color icons (e.g. Tango icon sets) keep their baked-in colors and are not affected by the color controls; monochrome icons follow the chosen color.
-
How do I offer preset sizes like font sizes?
-
The size is the standard Gutenberg Dimensions panel (
supports.dimensions.width, like the core Icon block): the block is square, and size presets are standard theme.jsondimensionSizesper block:{ "version": 3, "settings": { "blocks": { "sf-icon-manager/svg-icon": { "dimensions": { "dimensionSizes": [ { "name": "S", "slug": "s", "size": "32px" }, { "name": "L", "slug": "l", "size": "64px" } ], "width": true } } } } }With presets the panel shows a slider that moves across the preset sizes, like the core Icon block. A toggle next to it switches to a custom value input with a slider, using the allowed units (
spacing.units).dimensions.width: falsedisables sizing entirely, so the block always renders at its default size.
Ressenyes
No hi ha ressenyes per a aquesta extensió.
Col·laboradors i desenvolupadors
«SVG Forge Icon Manager» és programari de codi obert. La següent gent ha col·laborat en aquesta extensió.
Col·laboradorsTraduïu «SVG Forge Icon Manager» a la vostra llengua.
Interessats en el desenvolupament?
Navegueu pel codi, baixeu-vos el repositori SVN, o subscriviu-vos al registre de desenvolupament per fisl de subscripció RSS.
Registre de canvis
0.3.4
- Readme: clarified that the sprite is a static SVG fragment file loaded by the browser via
<use>(no JS on the frontend), added the custom icon sets tutorial link and a «Cache friendly» selling point. - High-resolution plugin screenshot.
0.3.3
Tested up to: 7.1(wp.org plugin check rejects minor versions).
0.3.2
- Admin stylesheet enqueued via
wp_enqueue_style. composer.jsonships in the plugin ZIP (required whenvendor/exists).- Test suite upgraded to WordPress 7.1.1 with PHPUnit 12.
0.3.1
- Admin UI branded as «SVG Forge Icon Manager» (settings menu, page title, native icons collection label); translations regenerated.
/i.svgno longer cached immutably: the local-file branch revalidates on every request (no-cache, must-revalidate) with real304 Not Modifiedresponses, so sprite changes are picked up immediately.- TypeScript sources, test files and type declarations no longer ship in the production plugin ZIP.
0.3.0
- Short URL
/i.svgfor the sprite, opt-in via thesfim_short_urlfilter. - Stricter upload sanitization (allowlist via enshrined/svg-sanitize instead of regex); automated dev releases from
main; the plugin ZIP ships its vendored dependencies. - Type declarations across the source (PHP 8.3+); padding applies to the SVG element, not the wrapper.
- New
docs/api.mdAPI reference; settings page shows the short URL under «Active sprite file».
0.2.1
- wp.org compliance: escaped SVG output with an input allowlist, direct-access guard in the render template, readme and changelog cleanup.
- Remove the now-discouraged
load_plugin_textdomain()call; WordPress loads translations for the plugin slug automatically.
0.2.0
- WordPress 7.1 native icon integration (experimental): symbols of the configured sprite are registered as an
sf-icon-managericon collection (setting «WordPress native icon integration», default Off). - New setting mode «Off + disable core Icon block» deregisters the built-in Icon block in the editor (including in content) and its frontend rendering.
- Registration is lazy: it only runs when needed (core Icon block or REST), keeping page-load cost independent of the icon count.
0.1.0
- Initial release.