Icon blockeasy-svg/icon

easy-svg/icon

A block bindings source that lets a core Icon block in a template show the icon the current post stores in a custom field.

Block · Easy SVG Pro · Status: Internal · Defined in includes/blocks/block-support.php

Internal: not part of the promised public surface. It may change without notice.

Usage

<!-- wp:icon {"metadata":{"bindings":{"icon":{"source":"easy-svg/icon","args":{"key":"easy_svg_icon"}}}}} /-->

Example

<!-- wp:icon {"metadata":{"bindings":{"icon":{"source":"easy-svg/icon","args":{"key":"easy_svg_icon"}}}}} /-->

Description

Registered on init at priority 20 while the blocks feature is on. It uses the postId context, so inside a Query Loop it reads each looped post. It answers only for the icon attribute; core/icon is not on core's bindings allow-list, so the plugin adds it through block_bindings_supported_attributes, which exists from WordPress 6.9. Any meta key written by the ACF, Lazy Blocks, Meta Box or WPBakery pickers works, as does the registered easy_svg_icon key.

Parameters

body
args.keystring

The post meta key holding a collection/slug reference. Must start with a letter or digit; protected keys with a leading underscore are refused.

Return value

returnstring|null

The stored icon reference for the icon attribute, or null.

On WordPress before 6.9 the binding quietly does not apply and the block renders nothing.