Quick StartRun many sites from one place

Run many sites from one place

One icon pack, Easy SVG and Easy SVG Pro on thirty client sites: your pack as a Composer package, one composer.json per site, the license from wp-config.php and WP-CLI aliases.

This recipe puts the same icon pack, Easy SVG and Easy SVG Pro on every client site from Git. It combines three things you may already use: Composer for the files, a must-use plugin for the switches, and WP-CLI aliases to check every site at once.

1. Your icon pack as a Composer package

Start from the icon pack template and give it a Git repository of its own. Its composer.json makes it a plugin package:

composer.json
{
  "name": "acme/acme-icons",
  "type": "wordpress-plugin",
  "license": "GPL-2.0-or-later",
  "require": { "php": ">=7.4", "composer/installers": "^1.0 || ^2.0" }
}

A version is a Git tag. Raise Version: in the plugin header to the same number, then tag:

git tag v1.0.0 && git push --tags

2. One composer.json per site

composer.json
{
  "repositories": [
    { "type": "composer", "url": "https://wpackagist.org", "only": ["wpackagist-plugin/*", "wpackagist-theme/*"] },
    { "type": "composer", "url": "https://composer.unleash-wp.com", "only": ["unleashwp/*"] },
    { "type": "vcs", "url": "git@github.com:acme/acme-icons.git" }
  ],
  "require": {
    "composer/installers": "^2.0",
    "wpackagist-plugin/easy-svg": ">=5.0",
    "unleashwp/easy-svg-pro": "^1.0",
    "acme/acme-icons": "^1.0"
  },
  "config": { "allow-plugins": { "composer/installers": true } }
}

On the build server, the license key is the password for composer.unleash-wp.com:

export COMPOSER_AUTH='{"http-basic":{"composer.unleash-wp.com":{"username":"unleashwp","password":"'"$UNLEASHWP_LICENSE_KEY"'"}}}'
composer install --no-dev --no-interaction --prefer-dist

A private pack repository also needs the build server's deploy key. Details on keys and CI: Install everything with Composer.

3. The license on every site

wp-config.php
define( 'EASY_SVG_PRO_LICENSE_KEY', getenv( 'EASY_SVG_PRO_LICENSE_KEY' ) );

Set the variable on each server. The site activates itself the next time an administrator opens wp-admin. Plan one login per site: a deploy script alone cannot activate a license.

4. The same switches everywhere

Use the must-use plugin from Global settings with per-site overrides. It ships with your code, so a new site gets the same switches without anyone running a command. Add the integrations your clients use: icon_field_acf, metabox, elementor, wpbakery. Turn on cli too, for the checks below.

5. Check every site at once

List your sites as WP-CLI aliases in wp-cli.yml, with a group for all of them:

wp-cli.yml
@client-a:
  ssh: deploy@client-a.example:/var/www/html
@client-b:
  ssh: deploy@client-b.example:/var/www/html
@clients:
  - @client-a
  - @client-b
wp @clients plugin activate easy-svg easy-svg-pro acme-icons
wp @clients easy-svg icons list
wp @clients easy-svg icons problems

icons list shows every collection with its count and origin. icons problems names every file a folder could not use.

6. Ship a new pack version

  1. Change the icons and run php tools/check-pack.php icons/acme-icons from the dev setup.
  2. Tag the new version.
  3. In each site project run composer update acme/acme-icons and deploy.
  4. wp @clients easy-svg icons problems reports that every folder registered everything.

When it worked

  • composer install lists wpackagist-plugin/easy-svg, unleashwp/easy-svg-pro and acme/acme-icons.
  • Easy SVG → Settings → License on each site shows the license as Active.
  • wp @clients easy-svg icons list shows your collection on every site.

Pitfalls