Skip to main content

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.

ConstantTypeDescription
UNBK_DEBUGboolEnable debug logging to files
UNBK_LICENSE_KEYstringLicense key (alternative to UI activation)
UNBLOCK_REMOVE_ALL_DATAboolRemove all plugin data on uninstall
UNBK_LIBRARY_TRUSTED_KEYSstringJSON 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 );
Common mistake

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.

ConstantDescription
UNBK_VERSIONCurrent plugin version
UNBK_SLUGPlugin slug (unbk)
UNBK_NAMEPlugin 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​