Skip to main content

Developer

UnBlock provides PHP hooks (actions and filters) to extend and customize the plugin.

Hooks Summary

Actions

HookDescription
unblock/loadedPlugin loaded, before services registered
unblock/initPlugin fully initialized
unblock/form/processedForm submission passed validation, before email
unblock/form/spam_detectedForm submission detected as spam

Filters

HookDescription
unblock/data/providersRegister custom data providers
unblock/data/filtersRegister custom expression filters
unblock/data/functionsRegister custom expression functions
unblock/data/post_metaFilter post meta values
unblock/data/user_metaFilter user meta values
unblock/data/term_metaFilter term meta values
unblock/data/option_metaFilter option meta values
unblock/data/allowed_optionsWhitelist accessible WordPress options
unblock/data/allowed_meta_keysWhitelist protected meta keys
unblock/query/post_argsPost query arguments
unblock/query/term_argsTerm query arguments
unblock/query/user_argsUser query arguments
unblock/query/item_argsItem query arguments
unblock/assets/css_inline_sizeCSS inline size threshold
unblock/html/forbidden_elementsForbidden HTML elements
unblock/html/forbidden_attributesForbidden HTML attributes
unblock/html/allowed_iframe_sourcesAllowed iframe sources
unblock/html/allowed_form_actionsAllowed form actions
unblock/svg/sanitizerSVG sanitizer instance
unblock/defaults/optionsDefault plugin options
unblock/filesystemFilesystem access control
unblock/settings/can_readRead permission for the settings REST endpoint
unblock/settings/can_writeWrite permission for the settings REST endpoint
unblock/form/actionForm action URL
unblock/form/client_ipClient IP for rate limiting
unblock/form/fieldsForm field values
unblock/form/allowed_extensionsAllowed file extensions
unblock/form/send_emailWhether to send the default email notification
unblock/form/emailEmail arguments before sending
unblock/ai/promptsSystem prompt parts before assembly
unblock/ai/agentsAI agents configuration
unblock/ai/skillsAI skills configuration
unblock/ai/timeoutAI request timeout
unblock/ai/max_tokensMaximum tokens for responses
unblock/ai/model_preferenceAI model override

Quick Start

Register a Custom Provider

add_filter( 'unblock/data/providers', function( $providers ) {

$providers['shop'] = [
'name' => [
'label' => __( 'Shop Name', 'flavor' ),
'callback' => [ My_Shop_Provider::class, 'name' ],
],
];

return $providers;

} );

Whitelist a WordPress Option

add_filter( 'unblock/data/allowed_options', function( $allowed ) {

$allowed[] = 'my_theme_settings';

return $allowed;

} );

Filter Meta Values

add_filter( 'unblock/data/post_meta', function( $value, $meta_key, $post_id ) {

if ( $meta_key === 'price' ) {
return floatval( $value );
}

return $value;

}, 10, 3 );

Next Steps

  • Actions — plugin lifecycle and form hooks
  • Debug Logging — diagnose expression and query errors