home/veldform/docs

Veldform / Docs

Action and filter hooks

Veldform is built around registries — field types, actions, payment gateways and captcha providers all share the same registration pattern, and your additions are treated exactly like the built-in ones. All hooks are prefixed veldform/.

Registering your own

Registries are built on init (priority 5), so hook at the default priority or later.

Field type

add_action( 'veldform/register_fields', function ( $fields ) {
    $fields->register( new MyField() ); // implements Veldform\Fields\FieldType
} );

A field type declares its label, schema (the options shown in the builder), sanitization, validation and rendering. Once registered, it shows up in the builder palette automatically — and becomes available to the AI form builder too.

Action

add_action( 'veldform/register_actions', function ( $actions ) {
    $actions->register( new MyAction() ); // implements Veldform\Actions\Action
} );

An action declares its config schema and a run( $context, $config ) method. Whatever run() returns is merged into the outputs, so later actions and the confirmation can use it as {{ output.your_key }}.

Payment gateway

add_action( 'veldform/register_gateways', function ( $gateways ) {
    $gateways->register( new MyGateway() ); // implements Veldform\Payments\PaymentGateway
} );

Captcha provider

add_filter( 'veldform/register_captcha', function ( array $providers ) {
    $provider = new MyCaptcha(); // implements Veldform\Captcha\CaptchaProvider
    $providers[ $provider->id() ] = $provider;
    return $providers;
} );

Other registration hooks

Hook Type Description
veldform/form_templates filter Add starter templates to the "New form" modal
veldform/connection_presets filter Add connection presets for your own service
veldform/liquid/filters action Register custom Liquid filters, e.g. $t->registerFilter( 'upper', fn( $v ) => strtoupper( $v ) );

Submission

Hook Type Description
veldform/submit action Fires after a successful submission. Receives $form_id, $clean, $schema, $entry_id ($entry_id is 0 when entry storage is off)
veldform/actions/context filter The context array passed to every action's run()
veldform/submit/rate_limit filter Max submissions per device per minute (default 30, 0 disables)

Rendering

Hook Type Description
veldform/render/control filter The bare control element of a field, receives $html, $field, $value, $ctx
veldform/render/field filter The complete field block (wrapper, label, control, help, error)
veldform/form/wrapper filter The full <form> HTML
veldform/render/styles filter Return false to not enqueue the plugin stylesheet, receives $enabled, $form_id
veldform/fields/countries filter The country list used by the address field

For overriding field markup from your theme, see Customization.

Email

Hook Type Description
veldform/email/use_template filter Whether to wrap a notification in the HTML template
veldform/email/logo filter The logo HTML in the template
veldform/email/footer filter The footer HTML in the template
veldform/email/html filter The final assembled email HTML

Merge tags

Hook Type Description
veldform/liquid/filters action Register custom Liquid filters

Payments

Hook Type Description
veldform/payment/{status} action Fires once per status change, e.g. veldform/payment/paid, veldform/payment/failed, veldform/payment/refunded. Receives the payment record
veldform/payment/amount_minor filter The final charge amount in minor units (cents)
veldform/payments/webhook_url filter The webhook URL passed to the provider
veldform/payments/expire_hours filter Hours before an abandoned checkout is marked expired (default 24)

Outgoing HTTP

These apply to all requests Veldform makes: the external API action, data providers and payment gateways.

Hook Type Description
veldform/http/before action Fires before a request, receives $url, $args
veldform/http/after action Fires after a request, receives $url, $args, $response
veldform/http/sslverify filter Whether SSL is verified (default true, except on local environments)
veldform/http/allow_host filter Allow a specific host past the internal-address guard
veldform/webhook/allow_internal filter Allow the external API action to reach internal/private hosts

Other

Hook Type Description
veldform/captcha/recaptcha_min_score filter The reCAPTCHA v3 pass threshold (default 0.5)
veldform/create_user/roles filter The selectable roles for the Create user action
veldform/upload_dir filter Where uploaded entry files are stored
veldform/ai/rate_limit filter AI requests per window (default 20)
veldform/log/enabled filter Return false to disable logging, receives $enabled, $event, $level
veldform/log/retention_days filter How long log entries are kept (default 30 days)