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.
What a generator controls
Section titled “What a generator controls”| Setting | Purpose |
|---|---|
| Name | A label for your reference. |
| Charset | The pool of characters keys are drawn from (e.g. ABCDEFGHJKMNPQRSTUVWXYZ23456789). |
| Chunks | Number of segments in a key. |
| Chunk length | Characters per segment. |
| Separator | Character between segments (e.g. -). |
| Prefix / Suffix | Optional fixed text wrapped around the key. |
| Default max activations | Seat default for keys issued from this generator. |
| Default valid days | Relative-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.
Creating a generator
Section titled “Creating a generator”License Manager → Generators → Add New. Fill in the format and defaults, then save. Products and plan license types can then select this generator.
Bulk-generating keys
Section titled “Bulk-generating keys”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 stringsOr over REST: POST /wp-json/wplm/v1/generators/{id}/generate.
Customising generated keys
Section titled “Customising generated keys”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 );