Actions and filters
One rule tells you which plugin a hook belongs to, and where to look for it. Ninety-five hooks exist purely for you to use.
- Advanced
- 8 min read
- Applies to 2.0
The naming rule
A hook prefixed attrua_ belongs to the free plugin. A hook prefixed
attrua_pro_ belongs to Pro.
That is the whole rule, and it holds throughout. If you know which plugin owns a behaviour, you know which prefix its hooks carry.
Four deliberate exceptions, fired by both plugins because Pro renders its own versions of the same templates and must offer the same extension points:
attrua_before_login_formattrua_after_login_formattrua_after_reset_formattrua_form_builder_after_cards
Coming from version 1.x? The two prefixes were used almost interchangeably,
and 41 hooks were renamed in 2.0 to establish the rule above. There are no
aliases: code attached to an old name stops running, silently. If you have
custom code hooked into either plugin, search it for attrua_ and check every
match against the current names before updating a live site.
The surface
145 hooks are fired across the two plugins, and 95 of them have no internal listener at all — they exist only so that you can attach to them.
Finding the one you need
Hook names describe what has happened, in the past tense, and carry the object they concern:
// After a licence is activated
add_action( 'attrua_pro_license_activated', function ( $key ) {
// …
} );
// After a security mode has been applied to the switches
add_action( 'attrua_pro_security_mode_applied', function ( $mode, $preset ) {
// …
}, 10, 2 );
Where a hook requests something and another announces it, the tense
distinguishes them — attrua_start_scheduled_maintenance asks for maintenance to
open, attrua_pro_maintenance_started reports that it has.
That distinction is not decoration. Firing the requesting hook from inside a listener on the same hook is an infinite loop, and this plugin has had one. If you are adding a hook of your own alongside these, keep the two roles separate.
Useful filters
| Filter | Changes |
|---|---|
attrua_pro_login_backoff_schedule | the failed-login wait times, as failures => seconds |
attrua_pro_recaptcha_score_threshold | the reCAPTCHA v3 score below which a submission is refused |
attrua_pro_disposable_email_domains | the list of throwaway email domains refused at registration |
attrua_pro_email_template_paths | where a theme's email template overrides are looked for |
attrua_pro_license_request_timeout | how long a licence call may take |
attrua_pro_submit_label_{flow} | a Form Builder flow's submit button text |
A worked example
Refusing a stricter set of email domains at registration:
add_filter( 'attrua_pro_disposable_email_domains', function ( array $domains ) {
$domains[] = 'example-throwaway.test';
return $domains;
} );
And loosening reCAPTCHA for a single form, without changing the site setting:
add_filter( 'attrua_pro_recaptcha_score_threshold', function ( $threshold ) {
return is_page( 'members-signup' ) ? 0.3 : $threshold;
} );
What comes next
Something missing or out of date? Tell support.