Troy Embed

Troy Embed is a code snippet you paste into your plugin. On WordPress admin pages, it silently installs and activates Troy Client if missing.

Consider Troy Packages:

If you distribute via a Troy Package, Troy Client is included automatically. Troy Embed is for specific situations where Packages aren't an option.

Not for WordPress.org Plugins:

Do not use Troy Embed with plugins hosted on WordPress.org. WordPress.org guidelines prohibit plugins from installing other plugins without explicit user consent. Violating this will get your plugin removed.

If your plugin is on WordPress.org, distribute Troy Client separately via a Troy Package.

The Snippet

Grab troy-embed/snippet.php from GitHub and include it in your plugin, or paste the code directly into your main plugin file.

How Troy Embed Works

  1. On any WordPress admin page, the snippet checks whether Troy Client is active.
  2. If not, it downloads and installs Troy Client from Deploy Troy's server.
  3. It then activates the plugin silently — no admin notices, no redirect.

The snippet is about 40 lines — under 1KB added to your plugin.

When to Use Troy Embed

  • You distribute plugins only through your own website (not WordPress.org).
  • You sell through marketplaces like CodeCanyon that allow bundled dependencies.
  • You want zero installation friction for self-distributed plugins.
  • You want to migrate existing users to Troy Client — consider making this opt-in so users aren't surprised by a new dependency.

When Not to Use Troy Embed

  • You distribute through WordPress.org — their guidelines prohibit it (see warning above).
  • You control distribution end to end — use Packages instead, they're cleaner for everyone.
  • You need to install multiple plugins or want progress feedback — use Troy Installer instead.

Source Code and License

The snippet is MIT licensed. Copy it, modify it, ship it.