License and Updates

  • JNext lesson
  • KPrevious lesson
  • FSearch lessons
  • EscClear search

Overview

ACF Blocks uses a license key system to enable automatic updates through the WordPress dashboard. The license manager is implemented in includes/license-manager.php as the ACF_Blocks_License_Manager class.

The license manager loads independently of the ACF requirement. You can activate your license even if ACF is not yet installed.

License Server

The license server is hosted at https://gauravtiwari.org/ and uses the Fluent Cart API. All requests are POST requests to https://gauravtiwari.org/?fluent-cart={action}.

The plugin’s item ID on the license server is 1150934.

Admin Page

The license management page is located at Settings > ACF Blocks License (options-general.php?page=acf-blocks-license). A “License” link also appears in the plugin action links on the Plugins screen.

The page shows one of three states:

  • No license – A form to enter and activate a license key.
  • Active license – Shows the masked key (format: ABCD****WXYZ), expiration date (or “Lifetime license”), and a deactivate button.
  • Expired license – Shows a renewal link and a form to enter a new key.

Activation

When you activate a license, the plugin sends a POST request to the license server with:

  • license_key – The key you entered.
  • item_id – The plugin’s item ID.
  • site_url – Your site’s home_url().
  • current_version – The installed plugin version.

On success, the server returns a status of valid along with an activation_hash and expiration_date. This data is stored in the acf_blocks_license option.

Deactivation

Deactivating sends a request to the license server and resets the local license data to inactive defaults. The license key is cleared from the database.

Automatic Verification

A weekly cron event (acf_blocks_verify_license) checks the license status against the remote server. If the server reports the license as no longer valid, the local status is updated accordingly.

The verification preferentially uses the activation_hash rather than sending the license key, adding a layer of security.

Update Checks

The plugin hooks into WordPress’s update system via pre_set_site_transient_update_plugins. When WordPress checks for plugin updates:

  1. If no valid license is present, the check is skipped entirely.
  2. If a valid license exists, the plugin calls the get_license_version API endpoint.
  3. The response is cached for 12 hours in the acf_blocks_update_info transient.
  4. If the remote version is newer than the installed version, it’s added to the WordPress update transient.

The plugin also hooks into plugins_api to provide plugin information (name, version, author, changelog) when WordPress requests it for the update details modal.

Admin Notices

An admin notice appears on the Plugins screen when the license status is expired. The notice links to the license management page. No notices are shown on other admin screens to avoid being intrusive.

Data Storage

  • acf_blocks_license (option) – Array containing license_key, status, activation_hash, expiration_date, and activated_at.
  • acf_blocks_license_last_check (option) – Unix timestamp of the last remote verification.
  • acf_blocks_update_info (transient, 12-hour TTL) – Cached response from the version check API.