License keys and automatic updates for WordPress plugins

To sell a WordPress plugin with license keys, copy one file, licers-wordpress.php, into your plugin and register it with your public key. Your customers get a license page and normal WordPress updates; you get a limit on sites per key, expiry and entitlements. It is free and takes no share of your sales.

Updated by the Licers team

Set it up

  1. Create a free account and add a product.
  2. Copy your public key and product id from the Integration page. The public key is safe to ship inside your app.
  3. Issue a key: set how many devices it may use, when it expires, and any entitlements.
  4. Add the code below. On the first check the device is bound to the key; past the device limit a new machine is refused.

Download licers-wordpress-1.0.0.php, rename it to licers-wordpress.php, and put it next to your main plugin file.

my-plugin.php
<?php/** * Plugin Name: My Plugin * Version: 1.0.0 * Update URI: https://example.com/my-plugin */require_once __DIR__ . '/licers-wordpress.php'; $my_plugin_license = Licers_WP_1_0_0::register( array(	'file'           => __FILE__,	'public_key'     => 'YOUR_PUBLIC_KEY',                // safe to ship	'product_id'     => 'YOUR_PRODUCT_ID',	'download_hosts' => array( 'downloads.example.com' ), // where your update zips are) ); if ( $my_plugin_license->feature( 'pro' ) === true ) {	require __DIR__ . '/pro.php';}

That is all. Your plugin now has a page under Settings, a link in the plugin list, and a check twice a day.

Automatic updates

  1. Add Update URI: https://your-domain/my-plugin to your plugin’s header, with your own domain. Without it nothing is changed about updates.
  2. Build a zip that contains one folder with your plugin’s name, and host it on one of your download_hosts.
  3. In Licers, open Releases, add the new version number and the link.

Customers with a valid key see the update in their dashboard, with your notes, and can switch on automatic updates. An expired or revoked key gets no updates; the plugin itself keeps running unless you decide otherwise.

The version is signed by Licers. The download link is not, so the kit only accepts https links to the hosts you list in your code. Keep that host safe: whoever controls it controls your customers’ updates.

In your code

CallWhat it does
is_licensed()True with a signed yes for this site that has not expired. No network
feature( 'pro' )A signed entitlement, or the default you pass as second value
status()Licensed or not, the message, the end date
page_url()The license page, for your own “Enter your key” link
Licers_WP_1_0_0::forget( 'my-plugin/my-plugin.php' )For uninstall.php: removes everything it stored

What is checked

  • One site is one device. example.com and www.example.com are the same; staging.example.com is another.
  • The database can’t make a license. The stored answer is Ed25519-signed and checked again when it is read. Edited entitlements, dates and copies from another site fail.
  • An outage changes nothing. The last signed yes stays good for 14 days. A refused key stops at the next check.
  • Only administrators can open the page or change the key, with WordPress’s own nonces. The key is never shown again.
  • Two plugins, two versions. The class name carries the version, so your customers can run several plugins with this kit.

We ran it in WordPress 7.1 with PHP 8.2: entering and refusing keys, permissions, tampering with the database, outages, revoking, the update screen and a one-click update. It needs WordPress 5.8 and PHP 7.4.

Questions and answers

May I use it for a plugin on wordpress.org?

Not for updates: wordpress.org updates the plugins it hosts, and has rules about licensing code. Use it for plugins you sell yourself, or for the separate Pro plugin.

What about the GPL?

Selling updates, support and downloads for GPL plugins is allowed, and that is what a key usually controls. The kit itself is MIT-licensed.

Can somebody remove the check?

Yes, PHP is source code. A nulled copy gets no updates, which is why most plugin sellers tie the key to updates and support.

Does it work for themes?

Not yet. The kit is for plugins.

How do customers get their key?

Connect Stripe, Paddle or Gumroad and each sale makes a key and emails it. Refunds revoke it, renewals extend it.

What does it cost?

Nothing today. Every feature is free and unlimited: products, keys, devices, validations, offline files and floating seats. See pricing.