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.…"}'
How long a link lives
- 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,authorandsource. - Font Awesome Pro is shared like any other pack. The Templates screen shows a license reminder for it; the API does not refuse.
Fetching (/packs/import-link)
- 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. - 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.
- The request goes to that one address:
CURLOPT_RESOLVEpinshost:443:ip, so a second, different DNS answer is never used. A transport that cannot be pinned is refused. redirection: 0,sslverify: true,timeout: 15,reject_unsafe_urls: true,limit_response_size16 MB + 1. No cookies, noAuthorization.- Only
200with a body startingPK\x03\x04and at most 16 MB is accepted. The bytes go to a temporary file and throughpacks_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
--hourstakes 1, 24 (default) or 168; anything else is an error.share listshowsid,collectionandexpiresin UTC, never the link.import-linkwithout--asand a taken slug imports under the free one and warns, likepack 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.
| Ability | Read-only | Destructive |
|---|---|---|
easy-svg-pro/list-share-links | yes | no |
easy-svg-pro/create-share-link | no | no |
easy-svg-pro/revoke-share-link | no | yes |
easy-svg-pro/import-pack-from-link | no | no |
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
- Recipes for agencies: when a plugin or a drop-in folder fits better than a link.
snippets/pro/wp-cli.md: everywp easy-svg sharecommand with its output.