Skip to main content
Easy Digital Downloads Documentation
Documentation, Reference Materials, and Tutorials for Easy Digital Downloads

Software Licensing – Updater Implementation for WordPress Plugins

Included with your Software Licensing extension purchase is a sample plugin, located in the samples directory within the Software Licensing zip file. Download the extension from your Account page on our website. It is highly recommended that you open this up and look at it in its entirety.

There are two components to the sample:

  1. The composer.json file that will set up everything you need to start working with the Software Licensing API in your WordPress plugin.
  2. The main plugin file, which includes the code to hook into the EDD Software Licensing SDK, a drop-in solution for WordPress plugin and theme developers to quickly integrate Easy Digital Downloads Software Licensing into their products without complex setup or custom admin interfaces.

Step 1: Install the Composer package

Update (or create) the composer.json file for your plugin in your main plugin directory. Run composer install to add the Software Licensing SDK to your plugin (note that this link includes the latest instructions and examples as well).

Step 2: Update your plugin to use the SDK

This snippet provides a starting point for the code required in your plugin to integrate with the SDK:

/**
* Plugin Name: AAA Sample Plugin
* Plugin URI: https://easydigitaldownloads.com
* Description: Illustrates how to include an updater in your plugin for EDD Software Licensing.
* Author: Sandhills Development, LLC
* Author URI: https://easydigitaldownloads.com
* Version: 1.0.0
* License: GNU General Public License v2.0 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/

add_action(
'edd_sl_sdk_registry',
function ( $init ) {
$init->register(
array(
'id' => 'edd-sample-plugin', // The plugin slug.
'url' => 'https://edd.local', // The URL of the site with EDD installed.
'item_id' => 83, // The download ID of the product in Easy Digital Downloads.
'version' => '1.0.0', // The version of the product.
'file' => __FILE__, // The path to the main plugin file.
)
);
}
);

if ( file_exists( __DIR__ . '/vendor/easy-digital-downloads/edd-sl-sdk/edd-sl-sdk.php' ) ) {
require_once __DIR__ . '/vendor/easy-digital-downloads/edd-sl-sdk/edd-sl-sdk.php';
}

Change the information to match your store:

  • id – Plugin/theme slug.
  • url – The store URL.
  • item_id – The item ID (on your store).
  • version – The current version number.
  • file – The main plugin file. Not needed for themes.
  • typeplugin or theme. Not needed for plugins.
  • weekly_check – Optional: whether to make a weekly request to confirm the license status. Defaults to true.

Once your plugin is activated, your customers can add their license key and opt in to allow your store to add their PHP and WordPress versions to their activation data:

That’s it!

Important notes

  • If you have issues with SSL verification when requesting updates, you can use the edd_sl_api_request_verify_ssl filter to disable the SSL Verification flag.
  • If you would like to prevent your users from enabling auto-updates for your theme or plugin, you can add a snippet to your distributed code to disable auto-updates:
add_filter( 'auto_update_plugin', 'edd_sample_disable_plugin_autoupdates', 10, 2 );
function edd_sample_disable_plugin_autoupdates( $update, $plugin ) {
	if ( 'my-plugin/my-plugin.php' === $plugin->plugin ) {
		return false;
	}

	return $update;
}

add_filter( 'auto_update_theme', 'edd_sample_disable_theme_autoupdates', 10, 2 );
function edd_sample_disable_theme_autoupdates( $update, $theme ) {
	if ( 'my-theme' === $theme->theme ) {
		return false;
	}

	return $update;
}