Constants
This page lists PHP constants you can use to configure UnBlock or detect its presence.
Configurable
Define these in wp-config.php to change plugin behavior.
| Constant | Type | Description |
|---|---|---|
UNBK_DEBUG | bool | Enable debug logging to files |
UNBK_LICENSE_KEY | string | License key (alternative to UI activation) |
UNBLOCK_REMOVE_ALL_DATA | bool | Remove all plugin data on uninstall |
UNBK_LIBRARY_TRUSTED_KEYS | string | JSON map of share URL to public key, pinning connected libraries to the trusted tier |
UNBK_DEBUG
Enables the built-in debug logger. When set to true, log files are created in wp-content/uploads/unblock/logs/. See Debug Logging for details.
define( 'UNBK_DEBUG', true );
UNBK_LICENSE_KEY
Activate your license via constant instead of the admin UI. Useful for automated deployments or version-controlled configurations.
define( 'UNBK_LICENSE_KEY', 'your-license-key' );
UNBLOCK_REMOVE_ALL_DATA
When set to true, all plugin data (options, CSS variables, selectors, at-rules) is deleted on uninstall — even if the "Remove data" option is unchecked in settings.
define( 'UNBLOCK_REMOVE_ALL_DATA', true );
This constant takes effect on uninstall, not deactivation. Deactivating the plugin does not remove data regardless of this constant.
UNBK_LIBRARY_TRUSTED_KEYS
Pin the Ed25519 signing key of a library you connected to, which moves it from the sanitized tier to the trusted tier. The value is a JSON object mapping a share URL to its public key, the one the origin shows in its Shared libraries dialog.
define( 'UNBK_LIBRARY_TRUSTED_KEYS', '{"https://agency.com/wp-json/unblock/v1/library/shared":"paste-the-origin-public-key"}' );
A value can also be an array of keys, to accept an old and a new one while the origin rotates:
define( 'UNBK_LIBRARY_TRUSTED_KEYS', '{"https://agency.com/wp-json/unblock/v1/library/shared":["oldkey…","newkey…"]}' );
Malformed JSON is ignored and logged as a warning. The library keeps working, sanitized. See Trust tiers for what the tier changes, or unblock/library/sources to pin the same key from code instead.
Read-Only
Defined by the plugin on load. Useful for feature detection and integrations.
| Constant | Description |
|---|---|
UNBK_VERSION | Current plugin version |
UNBK_SLUG | Plugin slug (unbk) |
UNBK_NAME | Plugin name (unblock) |
Example: Feature detection
if ( defined( 'UNBK_VERSION' ) && version_compare( UNBK_VERSION, '1.5.0', '>=' ) ) {
// Use a feature introduced in 1.5.0.
}
Next steps
- Actions — plugin lifecycle and form hooks
- Library filters — register a source, authorize a shared pull
- Debug Logging — diagnose expression and query errors