Abilitieseasy-svg-pro/add-icon

easy-svg-pro/add-icon

Stores one SVG icon in the free icon library, through the same sanitizer and hardener an upload meets.

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-icon' )->execute( array $input ): array|WP_Error

Example

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

Description

The write goes through the free plugin's easy_svg_add_icon(), so byte cap and complexity guard apply. A taken name gets a numbered suffix (arrow-2) and the returned slug is read back after the write; nothing is ever overwritten. Refusals come back as WP_Error with codes such as easy_svg_pro_not_svg, easy_svg_pro_too_large or easy_svg_pro_no_store (409 when the library is off or the free plugin too old). 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
labelstring

Required. The icon's human name; the stored slug is derived from it.

body
markupstring

Required. The SVG markup as a complete <svg> element.

Return value

returnobject|WP_Error

added, slug (as stored), label, collection (always easy-svg) and source (library), or a WP_Error.

Gives an AI agent write access to the icon library. Any user with manage_options, including one using an application password, can run it once the feature is on.