Abilitieseasy-svg-pro/save-set

easy-svg-pro/save-set

Replace the icons of a set.

Ability · Easy SVG Pro · Defined in includes/abilities/manage.php

Usage

wp_get_ability( 'easy-svg-pro/save-set' )->execute( array $input ): array|WP_Error

Example

<?php
$ability = wp_get_ability( 'easy-svg-pro/save-set' );
if ( $ability ) {
	$result = $ability->execute( array(
		'set_id' => 42,
		'icons'  => array(
			'logo' => array(
				'label'  => 'Logo',
				'markup' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 12h16"/></svg>',
			),
		),
	) );
}

Description

Writes the whole set: every icon it should hold afterwards, with labels and keywords. An icon left out is removed. Read the set with get-set first; this is how keywords are changed.

Runs POST /wp-json/easy-svg-pro/v1/sets/&#123;set_id&#125; through rest_do_request(), so the route's own permission check, argument schema and handler do the work. The ability adds no write path of its own.

Registered while the AI agents (MCP) switch and the Collections feature are on. Permission: the user needs manage_options, and every call asks the route's own check again.

Destructive: it overwrites or removes what is there. Read first, preview where a preview exists. Calling it twice with the same input has the same effect as once.

Parameters

body
set_idinteger

Required. The icon set post id. At least 1.

body
iconsobject|array

Required. Every icon the set should hold after this write. The set is replaced, not merged: an icon left out is removed.

body
labelstring

Optional. The set name. Left alone when absent or blank.

Return value

returnarray|WP_Error

What the matching Icons panel screen receives for the same action. An array on success, a WP_Error with the route's code and status on failure.