ConstantsEASY_SVG_PRO_LICENSE_KEY

EASY_SVG_PRO_LICENSE_KEY

Put the Easy SVG Pro licence key in wp-config.php so a site activates itself on the first admin visit, without anyone typing the key in.

Constant · Easy SVG Pro · Status: Stable

Instead of pasting the licence key into Icons → License, you can define it in wp-config.php. The site then activates itself the next time an administrator opens wp-admin. This is how agencies roll out many sites without visiting each licence screen.

Usage

define( 'EASY_SVG_PRO_LICENSE_KEY', 'your-licence-key' );

Put it in wp-config.php, above the line /* That's all, stop editing! */.

When to use it

  • You deploy many sites from a template, a script or a hosting panel and want each one to activate on its own.
  • You keep secrets in environment variables and want the key to come from there.
  • You do not want the key to pass through a browser at all.

Do not use it when:

  • You only run one site and activate it once. The License tab is simpler, and you can sign in to your UnleashWP account there instead of using a key.
  • You need the site to activate during a WP-CLI run or a cron job. Activation from the constant only happens in wp-admin (see How it works).

Parameters

body
EASY_SVG_PRO_LICENSE_KEYstring

Your licence key from the UnleashWP account. Must be a string; it is trimmed. Any other type, or an empty string, counts as not set.

Return value

returnnone

A constant has no return value. The License tab says that a key is set in wp-config.php and, after a failed attempt, why it failed.

Default

Not defined. The site is activated through the License tab instead.

Examples

From an environment variable

// wp-config.php
$acme_key = getenv( 'EASY_SVG_PRO_LICENSE_KEY' );
if ( is_string( $acme_key ) && '' !== $acme_key && ! defined( 'EASY_SVG_PRO_LICENSE_KEY' ) ) {
	define( 'EASY_SVG_PRO_LICENSE_KEY', $acme_key );
}
unset( $acme_key );

Checking the value first keeps an unset variable from defining the constant as false.

Only on production

// wp-config.php
if ( 'production' === getenv( 'WP_ENVIRONMENT_TYPE' ) && ! defined( 'EASY_SVG_PRO_LICENSE_KEY' ) ) {
	define( 'EASY_SVG_PRO_LICENSE_KEY', (string) getenv( 'EASY_SVG_PRO_LICENSE_KEY' ) );
}

Staging copies then stay unbound and do not use a seat.

Check whether a site picked it up

wp eval 'echo defined( "EASY_SVG_PRO_LICENSE_KEY" ) ? "constant set" : "no constant";'

How it works

  1. An administrator opens wp-admin. On multisite it has to be a network administrator, because one licence seat covers the whole network.
  2. If the site is not activated yet, it sends the key once to your UnleashWP account and is activated. The key itself is never saved in the database.
  3. If that fails, the License tab shows why, and the site tries again later on its own.

Activation alone does not switch anything on. Each Pro feature still has its own switch under Icons → Features.

A real licence key in wp-config.php is a secret. Keep wp-config.php out of version control, or read the key from an environment variable as shown above. Never commit it to a theme or plugin repository.

Pitfalls

  • Deactivating does not stick. If you deactivate on the License tab while the constant is still defined, the next admin page load activates the site again. Remove the constant first.
  • Changing the key does nothing on a bound site. The constant is only read while the site is not activated. To move a site to another key, remove or change the constant and deactivate on the License tab.
  • WP-CLI and cron never activate. A freshly deployed site stays unlicensed until an administrator opens wp-admin once, so wp easy-svg ... commands refuse until then.
  • Every bound copy uses a seat. A staging clone with the same constant tries to bind as its own installation. Define the constant only where you want a seat used.
  • A typo waits. A wrong key is retried later, not right away. After fixing the constant, the next attempt may be some time away.