Skip to content

Generators

A generator is a reusable template that defines how license keys are formatted and what defaults issued keys inherit. Instead of configuring every license by hand, you define a generator once and point products (or plan license types) at it.

SettingPurpose
NameA label for your reference.
CharsetThe pool of characters keys are drawn from (e.g. ABCDEFGHJKMNPQRSTUVWXYZ23456789).
ChunksNumber of segments in a key.
Chunk lengthCharacters per segment.
SeparatorCharacter between segments (e.g. -).
Prefix / SuffixOptional fixed text wrapped around the key.
Default max activationsSeat default for keys issued from this generator.
Default valid daysRelative-expiry default for issued keys.

A generator producing 4 chunks of 4 characters with a - separator and prefix WPLM- yields keys like WPLM-A1B2-C3D4-E5F6-G7H8.

License Manager → Generators → Add New. Fill in the format and defaults, then save. Products and plan license types can then select this generator.

Generate a batch of unique keys into the pool — each candidate is hashed and checked against existing keys to guarantee uniqueness:

$keys = wplm_generate_keys( $generator_id, 100 ); // 100 unique key strings

Or over REST: POST /wp-json/wplm/v1/generators/{id}/generate.

Filter every freshly generated key string before it is stored:

add_filter( 'wplm_generated_key_string', function ( string $key, $generator ) {
return strtoupper( $key );
}, 10, 2 );