During the development of my new plugin SCW Stock Control for WooCommerce I could not get the plugin to show the available update. Checking the official documentation did not provide a solution, all settings were correct. So looking at the code I realised that EDD caches the version number for 3 hours in the options table.

/**
	 * Adds the plugin version information to the database.
	 *
	 * @param string $value
	 * @param string $cache_key
	 */
	public function set_version_info_cache( $value = '', $cache_key = '' ) {

		if ( empty( $cache_key ) ) {
			$cache_key = $this->get_cache_key();
		}

		$data = array(
			'timeout' => strtotime( '+3 hours', time() ),
			'value'   => wp_json_encode( $value ),
		);

		update_option( $cache_key, $data, 'no' );

		// Delete the duplicate option
		delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ) );
	}

The option name is generated by EDD with the string “edd_sl_” and an MD5 hash of the plugin information:

/**
	 * Gets the unique key (option name) for a plugin.
	 *
	 * @since 1.9.0
	 * @return string
	 */
	private function get_cache_key() {
		$string = $this->slug . $this->api_data['license'] . $this->beta;

		return 'edd_sl_' . md5( serialize( $string ) );
	}

The Fix

The fix for my development site was to go in PHPMyAdmin to the “Options” table and delete the options where the option name started with “edd_sl_”.

A simple quick fix but had me scratching my head for a bit 😉

Leave a Reply

Your email address will not be published.