Skip to main content

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

HookTypeStatus
mk_security_before_turnstile_renderActionPublic
mk_security_protected_formsFilterPublic
mk_security_rate_limit_rulesFilterPublic
mk_security_turnstile_action_enabledFilterPublic

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 parameterSource valueNotes
$action$actionAdditional context passed by the hook.
$args$argsAdditional 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 parameterSource valueNotes
$forms$formsValue 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 parameterSource valueNotes
$rules$rulesValue 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 parameterSource valueNotes
$enabled$enabledValue passed through the filter. Source default: $enabled.
$action$actionAdditional 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.