Check License in Plugin Updates

I want to warn you – this tutorial is not for beginners 😈. Besides, you’d better read about creating a custom plugin update server at first.

Step 1. Pass a License Key to info.json

Make the replacements in the code here on line 20 and here on line 9.

$remote = wp_remote_get( 
			'license_key' => urlencode( get_option( 'some_license_key' ) )
		'timeout' => 10,
		'headers' => array(
			'Accept' => 'application/json'

If it is not 100% clear for you, let me describe. All we need to do is to pass an additional GET parameter to a json file URL, like this: info.php?license_key={KEY}.

But the proper way to do it is:

Step 2. Make your info.json a PHP file!

I hope it doesn’t sound crazy for you, 🙃 maybe you didn’t know that but a PHP file can return any file type you want if you pass Content-Type parameter to it. So, let’s create the info.php file and don’t forget to make the replacements in the previous step.

$update = array();


// here we generate our JSON response

// no update is available by default
$update[ 'download_url' ] = '';

if( ! empty( $_GET['license_key' ] ) && license_check_logic( $_GET[ 'license_key' ] ) {
	$update[ 'download_url' ] = 'pass the URL to plugin ZIP archive here';


header( 'Content-Type: application/json' );
echo json_encode( $update );

license_check_logic() is just your custom function that checks if a license key is valid or not and return true or false accordingly.

And here is the WordPress magic – if you would like to disable plugin updates but leave the update notice, all you need to do is to pass the empty download_url parameter in your info.json (I mean info.php).

This is how it will look in admin area:

WordPress default plugin update notice when download_url parameter was not passed.

Everything seems OK on the screenshot except one thing – we didn’t provide enough information for plugin users, how to renew. Let’s do it in the next step!

Step 3. Add some info at the end of your plugin update notice

Every time I work with WordPress, I understand how much I love it ❤️ – it allows to do so awesome things with just a small amount of code. And the below one will add our custom message at the end of WordPress default update message.

add_action( 'in_plugin_update_message-YOUR-PLUGIN/YOUR-PLUGIN.php', 'misha_update_message', 10, 2 );
function misha_update_message( $plugin_info_array, $plugin_info_object ) {
	if( empty( $plugin_info_array[ 'package' ] ) ) {
		echo ' Please renew your license to update. You can change your license key in Settings > General';

The result:

Custom plugin update message can be configured with a simple WordPress action hook.

If you would like me to publish a specific tutorial, just let me know.

Misha Rudrastyh

Misha Rudrastyh

Hey guys and welcome to my website. For more than 10 years I've been doing my best to share with you some superb WordPress guides and tips for free.

Need some developer help? Contact me

Follow me on X