easy-svg-pro/v1/client/swap
Replaces the drawing behind an existing icon in a published set, keeping its name and label.
REST endpoint · Easy SVG Pro · Status: Internal · Defined in includes/client/client-mode.php
Usage
POST /wp-json/easy-svg-pro/v1/client/swap
Example
curl -X POST "https://example.com/wp-json/easy-svg-pro/v1/client/swap" \
-H "X-WP-Nonce: $NONCE" -b "$COOKIES" \
-H "Content-Type: application/json" \
-d '{"set_id": 42, "slug": "arrow", "markup": "<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 12h16"/></svg>"}'
Description
The slug must already be in the set: a swap never adds, renames or removes an icon. The markup goes through the same sanitizer and hardener as an administrator's upload. Only published sets are accepted, so a draft or private set cannot be edited this way. The write fires easy_svg_pro_set_icons_written like every other set write.
Permission: The easy_svg_swap_icons capability and an active licence with Client mode switched on. Administrators with manage_options get the capability automatically while the feature is on.
Parameters
The icon set holding the icon to replace. Minimum 1.
The name of the icon to replace. It has to exist already.
The new SVG markup. Sanitized and hardened on the way in, whatever is sent.
Return value
{set_id, slug, label}. Errors are easy_svg_pro_swap_<state>: 404 for no_set, 422 for not_found, empty, no_sanitizer or no_hardener.
Response
{set_id, slug, label}. Errors are easy_svg_pro_swap_<state>: 404 for no_set, 422 for not_found, empty, no_sanitizer or no_hardener.
{
"set_id": 42,
"slug": "arrow",
"label": "Arrow"
}
easy_svg_swap_icons can change what every page using that icon draws.