The SLSWC Client library integrates with the WordPress update system to check for and deliver plugin/theme updates from your license server.
How Update Checks Work
Plugin Updates
Source: libraries/slswc/client/src/Plugin.php
- WordPress periodically checks for plugin updates and fires the
pre_set_site_transient_update_pluginsfilter. - The
Plugin::update_check()method sends acheck_updaterequest to the license server with the license key, domain, and current version. - If the license is valid and a newer version exists, the server returns
software_detailscontaining the new version, download URL, changelog, etc. - The client adds the update to the WordPress transient, so the standard update notification appears.
WordPress SLSWC Client License Server
| | |
|-- update check ---------> update_check() |
| | |
| |-- POST /check_update ---> |
| | |
| |<-- software_details ------|
| | |
|<-- modified transient --------| |
| | |
|-- show update notification | |
Theme Updates
Source: libraries/slswc/client/src/Theme.php
The same flow applies using the pre_set_site_transient_update_themes filter.
Plugin Information Dialog
When a user clicks "View details" on a plugin update, WordPress fires the plugins_api filter. The Plugin::add_plugin_info() method intercepts this and returns the product information from the license server, including:
- Description
- Changelog
- Version
- Author
- Banners (low/high resolution)
- Download URL
Download URL Resolution
The download URL comes from the software_details->package field in the server response. This URL points to the WooCommerce downloadable file attached to the product.
The client also registers a filter on http_request_host_is_external to ensure WordPress allows downloading from the license server's domain, even if it differs from the site's own domain.
Unlicensed Update Messages
If a user tries to update without a valid license, the Plugin::need_license_message() method adds a notice below the plugin row in the plugins list:
You need a valid license to receive automatic updates.
This is hooked via in_plugin_update_message-{plugin_dir_file}.
Update Information Override
The Plugin::change_update_information() method filters site_transient_update_plugins and transient_update_plugins to ensure the download URL and other metadata are correctly set from the license server response.
Caching
Update check responses are cached in WordPress transients by the server. Cache expiry is filterable:
| Filter | Default | Description |
|---|---|---|
slswc_check_for_update_cache_expiry | 12 hours | Server-side cache for update check responses |
slswc_plugins_cache_expiry | 2 hours | Client-side cache for plugin list |
slswc_themes_cache_expiry | 2 hours | Client-side cache for theme list |
Environment Detection
The server determines whether a request comes from a staging or live environment based on the requesting domain. The client sends the domain parameter with every request, and the server checks:
- Known development TLDs (
.local,.test,.dev, etc.) - Known staging subdomains (
staging.,dev.,test., etc.) - Local IP addresses (
127.0.0.1,::1,10.x.x.x,192.168.x.x)
Staging activations are tracked separately and have their own limits.
Filters
| Filter | Description |
|---|---|
slswc_request_info_{text_domain} | Modify the request payload before sending |
slswc_request_options_{text_domain} | Modify wp_safe_remote_get / wp_safe_remote_post options |
slswc_client_get_actions | Actions that use GET instead of POST (default: product, products) |
slswc_client_logging | Enable/disable client-side logging |
Related Pages
- Client Library Overview โ Architecture and class reference
- Plugin Integration โ Full integration guide for WordPress plugins
- Theme Integration โ Full integration guide for WordPress themes
- DRM โ Grace periods and enforcement when updates are blocked due to invalid licenses
- License Endpoints โ The
check_updateendpoint that the client calls