easy-svg-pro/restore-set-icons
Restore icons deleted from a set.
Ability · Easy SVG Pro · Defined in includes/abilities/manage.php
Usage
wp_get_ability( 'easy-svg-pro/restore-set-icons' )->execute( array $input ): array|WP_Error
Example
<?php
$removed = wp_get_ability( 'easy-svg-pro/remove-icon-from-set' )->execute( array(
'set_id' => 42,
'slugs' => array( 'arrow' ),
) );
$ability = wp_get_ability( 'easy-svg-pro/restore-set-icons' );
if ( $ability && ! is_wp_error( $removed ) ) {
$result = $ability->execute( array(
'set_id' => 42,
'keys' => array_column( $removed['trashed'], 'key' ),
) );
}
Description
Brings icons back into their set out of the trash. The keys are in the answer of easy-svg-pro/remove-icon-from-set, under trashed.
Runs POST /wp-json/easy-svg-pro/v1/sets/{set_id}/icons/restore 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.
Writes to the site. Twice with the same input does what once does.
A set that is in the trash itself is refused: its icons come back with the set. When the name is taken in the set again, the icon is not overwritten and stays in the trash. There is no ability to delete for good; that is done in the trash of the Icons library.
Parameters
Required. The icon set post id. At least 1.
Required, at least one, at most 25. Keys of the trashed icons, as remove-icon-from-set reported them.
Return value
An array on success, a WP_Error with the route's code and status on failure. It names id, slug, restored (the names of the icons brought back), count and report: one row per key with key, slug and state: restored, not_found (no such key), exists (the name is taken in the set again) or refused (nothing of the stored markup was left after checking).