Abilitieseasy-svg-pro/add-icons-to-set

easy-svg-pro/add-icons-to-set

Adds icons to an existing icon set without touching the icons already in it.

Ability · Easy SVG Pro · Status: Internal · Defined in includes/abilities/abilities.php

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

Usage

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

Example

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

Description

Runs the same path as POST /sets/{id}/icons/add: every icon is sanitized and hardened, merged against what is stored, and a name already in the set is reported as exists instead of being overwritten. Needs the Icon set editor feature too, else easy_svg_pro_no_editor (409). Fires easy_svg_pro_set_icons_written through the shared write. Registered only when the Abilities API exists, the licence is active and the AI agent abilities feature is on. Permission: the user must have manage_options.

Parameters

body
set_idinteger

Required. The icon set post id to add to.

body
iconsobject

Required. Icons keyed by name, each value with label and markup.

Return value

returnobject|WP_Error

set_id, slug (the registered collection slug) and report, one row per icon with state added or exists.

A set id that is not an icon set does not return an error: the internal REST error is dropped and the result has an empty slug and an empty report. Check that report is not empty.