Security Hooks
Use these hooks to customize MentorKit security forms, Turnstile rendering, and risk/rate-limit behavior.
Only custom MentorKit hooks from docs-lms/hook-metadata.json are documented here. Classic WordPress, WooCommerce, Polylang, Astra, and other external hooks are intentionally excluded.
Documented hooks: 4.
Documented Hooks
| Hook | Type | Status |
|---|---|---|
| mk_security_before_turnstile_render | Action | Public |
| mk_security_protected_forms | Filter | Public |
| mk_security_rate_limit_rules | Filter | Public |
| mk_security_turnstile_action_enabled | Filter | Public |
mk_security_before_turnstile_render
Type: Action
Category: Security
Source: includes/security/class-mk-turnstile.php:68
Status: Public
When It Runs
Fires before turnstile render. The source call is inside MK_Turnstile::render_widget().
Parameters
| Callback parameter | Source value | Notes |
|---|---|---|
$action | $action | Additional context passed by the hook. |
$args | $args | Additional context passed by the hook. |
Example
add_action(
'mk_security_before_turnstile_render',
function ( $action, $args ) {
// Add your integration logic here.
},
10,
2
);
Notes
- Keep callbacks small and scoped to the source context shown above.
mk_security_protected_forms
Type: Filter
Category: Security
Source: includes/security/class-mk-turnstile.php:47
Status: Public
When It Runs
Filters protected forms. The source call is inside MK_Turnstile::get_frontend_form_map().
Parameters
| Callback parameter | Source value | Notes |
|---|---|---|
$forms | $forms | Value passed through the filter. Source default: $forms. |
Return Value
Return the filtered $forms value. Source default: $forms. If you do not need to change it, return the original value unchanged.
Example
add_filter(
'mk_security_protected_forms',
function ( $forms ) {
return $forms;
},
10,
1
);
Notes
- Keep callbacks small and scoped to the source context shown above.
mk_security_rate_limit_rules
Type: Filter
Category: Security
Source: includes/security/class-mk-risk-engine.php:188
Status: Public
When It Runs
Filters rate limit rules. The source call is inside MK_Risk_Engine::get_rules().
Parameters
| Callback parameter | Source value | Notes |
|---|---|---|
$rules | $rules | Value passed through the filter. Source default: $rules. |
Return Value
Return the filtered $rules value. Source default: $rules. If you do not need to change it, return the original value unchanged.
Example
add_filter(
'mk_security_rate_limit_rules',
function ( $rules ) {
return $rules;
},
10,
1
);
Notes
- Keep callbacks small and scoped to the source context shown above.
mk_security_turnstile_action_enabled
Type: Filter
Category: Security
Source: includes/security/class-mk-security-settings.php:270
Status: Public
When It Runs
Filters turnstile action enabled. The source call is inside MK_Security_Settings::is_turnstile_action_enabled().
Parameters
| Callback parameter | Source value | Notes |
|---|---|---|
$enabled | $enabled | Value passed through the filter. Source default: $enabled. |
$action | $action | Additional context passed by the hook. |
Return Value
Return the filtered $enabled value. Source default: $enabled. If you do not need to change it, return the original value unchanged.
Example
add_filter(
'mk_security_turnstile_action_enabled',
function ( $enabled, $action ) {
return $enabled;
},
10,
2
);
Notes
- Keep callbacks small and scoped to the source context shown above.