Developer guidesShare links

Share links

Share links for developers: WP-CLI, abilities, the import route and the fetch rules. One collection goes from one site to another by a secret link that expires and can be revoked.

A share link hands one collection from one site to another: site 1 makes a secret link that expires, site 2 imports it as a new icon set. Share links follow the Templates switch (key templates) under Settings → Features: on by default, never touched by a quick setup profile, and on exactly when Templates is on. Only easy-svg-pro.json can lock them off on their own, with "share_links": false. Every command, ability and route below works only while they are on and the license is active.

Try it

On site 1, with WP-CLI and Share links on:

wp easy-svg share create house-icons

What you see: the link alone on one line, then Success: Link made, shown only now. It expires 2026-11-05 14:00 UTC. Copy the link now. You can copy it again later on the Share links screen. On site 2, with Collections on as well:

wp easy-svg pack import-link 'https://site-1.example/wp-json/easy-svg-pro/v1/share/a1b2c3d4e5f6.…'

It ends with Success: 48 icons imported as house-icons.

Import over REST

POST /wp-json/easy-svg-pro/v1/packs/import-link imports a share link on site 2. It needs manage_options and the Collections switch (sets). The body takes url and an optional slug, and the answer is the same as for /packs/import.

# Site 2: cookie + nonce, or an application password
curl -u admin:APP_PASSWORD -X POST https://site-2.example/wp-json/easy-svg-pro/v1/packs/import-link \
  -H 'Content-Type: application/json' -d '{"url":"https://site-1.example/wp-json/easy-svg-pro/v1/share/a1b2c3d4e5f6.…"}'
  • A link ends in <id>.<secret>: 12 hex characters, a dot and 43 more characters. Copy it whole.
  • The site keeps the secret only encrypted with its own salts, so a database dump alone opens no link.
  • A link belongs to its set. While that set is in the trash, the link answers like an unknown one. Once the set is deleted for good, the link ends.
  • A site has at most 50 live links. Expired links drop out on their own, and a revoked link ends at once.

What site 2 gets

  • An unknown, expired or revoked link, and a link from a site where Share links is off, all get the same 404 easy_svg_pro_share_gone.
  • The ZIP is the same as a pack export: switched-off icons are left out, and the manifest names license, author and source.
  • Font Awesome Pro is shared like any other pack. The Templates screen shows a license reminder for it; the API does not refuse.
  1. The URL must be https, port 443 or none, no credentials, no fragment, a host name (never an IP literal or a single label), and the path must be the share route: …/wp-json/easy-svg-pro/v1/share/<token> or …/?rest_route=/easy-svg-pro/v1/share/<token>, nothing more.
  2. The host is resolved once (A and AAAA). Every address must be public; one private, loopback, link-local, CGNAT, multicast, documentation or reserved address refuses the whole name. NAT64 addresses are judged by the IPv4 they carry.
  3. The request goes to that one address: CURLOPT_RESOLVE pins host:443:ip, so a second, different DNS answer is never used. A transport that cannot be pinned is refused.
  4. redirection: 0, sslverify: true, timeout: 15, reject_unsafe_urls: true, limit_response_size 16 MB + 1. No cookies, no Authorization.
  5. Only 200 with a body starting PK\x03\x04 and at most 16 MB is accepted. The bytes go to a temporary file and through packs_import_file(): the sanitizer, the hardener, the ZIP reader's caps and the slug collision answer, exactly like an upload.

Errors come back as 400 easy_svg_pro_share_fetch (404 when the other site says the link is gone) with a sentence for the screen.

WP-CLI

Needs the WP-CLI and Share links switches; import-link also Collections.

# Site 1: the URL is printed alone on its line, only this once
wp easy-svg share create house-icons --hours=24
wp easy-svg share list --format=json
wp easy-svg share revoke a1b2c3d4e5f6

# Site 2
wp easy-svg pack import-link 'https://site-1.example/wp-json/easy-svg-pro/v1/share/a1b2c3d4e5f6.…' --as=house-icons
  • --hours takes 1, 24 (default) or 168; anything else is an error.
  • share list shows id, collection and expires in UTC, never the link.
  • import-link without --as and a taken slug imports under the free one and warns, like pack import.
  • Every refusal of the route is the command's error, with a non-zero exit code.

Abilities

Registered while Share links is on, for manage_options. Each runs through the plugin's own REST handler, so its permission check and schema decide.

AbilityRead-onlyDestructive
easy-svg-pro/list-share-linksyesno
easy-svg-pro/create-share-linknono
easy-svg-pro/revoke-share-linknoyes
easy-svg-pro/import-pack-from-linknono
wp_get_ability( 'easy-svg-pro/create-share-link' )->execute( array( 'collection' => 'house-icons', 'hours' => 24 ) );

create-share-link answers with the url once. An agent that is not meant to hand collections out should run without the Share links switch.

Code

includes/packs/share-links.php (share_link_create() and share_link_url_create(); share_import_url(): the one way for screen, WP-CLI and abilities), includes/cli/cli.php, includes/abilities/manage.php.

Next