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

Software Licensing – Updater Implementation for WordPress Themes

With the Software Licensing extension for Easy Digital Downloads you can set up automatic upgrades for themes. This does not mean that your customer’s theme will update itself but rather that your customer may update their theme using the traditional WordPress update tools, as if the theme were hosted on WordPress.org.

There are two key components to the sample:

  1. The composer.json file which will set up everything you need to start working with the Software Licensing API in your WordPress plugin.
  2. The functions.php 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 theme to use the SDK

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

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 theme 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:

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;
}