easy-svg-pro/import-pack
Import a pack.
Ability · Easy SVG Pro · Defined in includes/abilities/packs.php
Usage
wp_get_ability( 'easy-svg-pro/import-pack' )->execute( array $input ): array|WP_Error
Example
<?php
$ability = wp_get_ability( 'easy-svg-pro/import-pack' );
if ( $ability ) {
$result = $ability->execute( array(
'archive' => 'UEsDBBQAAAAI...',
) );
}
Passing on what export-pack returns
<?php
$export = wp_get_ability( 'easy-svg-pro/export-pack' )->execute( array( 'collection' => 'brand' ) );
if ( ! is_wp_error( $export ) ) {
// export-pack answers with `base64`, which import-pack takes as it is.
$result = wp_get_ability( 'easy-svg-pro/import-pack' )->execute( array(
'base64' => $export['base64'],
) );
}
Description
Imports a pack zip or a Font Awesome download as a new icon set. When the slug of a single pack is taken, nothing is written and the answer names a free slug: call again with that slug, or another, to import under it. A bundle of several packs, as export-pack-bundle or an icon plugin makes, imports each pack at once and gives a taken name a free variation such as -2 or -3. Send dry_run first to see each name and collision without writing anything.
Hands its work to the same builder or importer the Templates screen (Easy SVG, Templates) uses. Archives travel as base64 in both directions.
Registered while the AI agents (MCP) switch and the Collections feature are on.
Permission: the user needs manage_options and an active license.
Writes to the site.
Parameters
The zip, base64 encoded. Give this or base64.
The same zip under the name export-pack answers with, so its output can be passed straight in. Give this or archive; when both are sent, archive is used.
The schema requires neither field. A call with neither is refused with easy_svg_pro_no_file (status 400) and a message naming both: "Pass the zip, base64 encoded, as archive or base64."
Optional. The collection slug to import under, when the one in the manifest is taken.
Optional. For a Font Awesome download: which style to import. One style per collection, because the styles share icon names.
Optional. Write nothing; answer the name each pack would be imported under and whether that name was taken.
Return value
What the Templates screen receives for the same import: slug, imported, refused, collision. An array on success, a WP_Error with the route's code and status on failure.