Abilitieseasy-svg-pro/copy-icons

easy-svg-pro/copy-icons

Copy icons into the icon library or a set.

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

Usage

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

Example

<?php
$ability = wp_get_ability( 'easy-svg-pro/copy-icons' );
if ( $ability ) {
	$result = $ability->execute( array(
		'refs' => array(
			'brand/logo',
		),
		'to'   => 'easy-svg',
	) );
}

Description

Copies icons into the icon library (to: easy-svg) or into an icon set. The source is never changed, and pages keep calling the original.

Runs POST /wp-json/easy-svg-pro/v1/library/copy 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 is on, which it is out of the box. Copying into a set also needs the Collections feature; copying into the icon library does not. Permission: the user needs manage_options, and every call asks the route's own check again.

Writes to the site.

Parameters

body
refsstring[]

Required. The icons to copy, as collection/slug.

body
tostring

Required. Where the copies go: easy-svg for the icon library, or a set by its collection slug.

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.