Admin Safety Guard 1.4.1 has 4 actions and 14 filters, read directly from its source code on Nov 19, 2026. The list updates automatically when a new version is released.
How to use these hooks
Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.
// Run your own code when Admin Safety Guard fires an action
add_action( 'tpsa_2fa_failed', function( $arg1, $arg2 ) {
// Your code runs here.
}, 10, 2 );
// Change a value Admin Safety Guard is about to use
add_filter( 'customize/login_templates', function( $templates ) {
// Change $templates here.
return $templates;
}, 10, 1 );Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.
All hooks
-
/** * Filter: Modify the available login templates. */ apply_filters( 'customize/login_templates', $templates ); -
/** * Fires when a two-factor code is rejected, so failures can be surfaced in the * monitoring log or an external SIEM. */ do_action( 'tpsa_2fa_failed', (int) $pending['user'], (int) $pending['tries'] ); -
/** * Filter whether a given user must pass two-factor authentication. */ apply_filters( 'tpsa_2fa_required_for_user', $required, $user ); -
/** * How to handle a request to the old login URL: '404' or 'home'. */ apply_filters( 'tpsa_default_login_behaviour', '404' ); -
/** * Filter whether the current request bypasses login-attempt limiting. */ apply_filters( 'tpsa_limit_login_exempt', false, $this->get_ip_address() ); -
/** * Ordered list of headers to inspect when proxy headers are trusted. */ apply_filters( 'tpsa_proxy_ip_headers', array( 'HTTP_CF_CONNECTING_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_REAL_IP', 'HTTP_CLIENT_IP', ) ); -
/** * Filter the audit checks, so other code can add its own. */ apply_filters( 'tpsa_security_audit_checks', $checks ); -
/** * Whether to trust client-supplied forwarding headers. */ apply_filters( 'tpsa_trust_proxy_headers', false ); -
apply_filters( 'login_redirect', $destination, $redirect_to, $user ); -
apply_filters( 'tpsa_2fa_issue_cooldown', 30 ); -
apply_filters( 'tpsa_2fa_resend_cooldown', 60 ); -
do_action( 'tpsa_admin_bar_after_settings', $screen_slug ); -
apply_filters( 'tpsa_otp_email_message', $message, $otp, $user ); -
apply_filters( 'tpsa_otp_email_subject', $subject, $otp, $user ); -
apply_filters( 'tpsa_settings_fields', array( 'analytics' => array( 'fields' => array(), ), 'admin-bar' => array( 'fields' => array( 'enable' => array( 'type' => 'switch', 'label' => __( 'Hide Admin Bar', 'admin-safety-guard' ), 'class' => '', 'id' => '', 'desc' => __( 'To enable/disable admin bar', 'admin-safety-guard' ), 'default' => 0, ), 'exclude' => array( 'type' => 'multi-check', 'label' => __( 'Exclude', 'admin-safety-guard' ... ); -
apply_filters( 'tpsa_settings_option', array( 'analytics' => array( 'label' => __( 'Safety Analytics', 'admin-safety-guard' ), 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-layout-dashboard-icon lucide-layout-dashboard"><rect width="7" height="9" x="3" y="3" rx="1"/><r... ); -
do_action( 'tpsa_threat_blocked', $type, $detail, $ip ); -
do_action( 'wp_login', $user->user_login, $user );
Generated from Admin Safety Guard's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.
Done for you
Rather have it built for you?
Tell us what should change and we’ll write and test the code using these hooks.
Custom hook snippet
from $49
A small, update-safe change built on the plugin’s own hooks.
- Code written against the plugin’s actions and filters
- Tested on a staging copy of your site
- Install instructions included
Typical turnaround: 2–3 business days
Choose thisPlugin customisation
from $149
New features or changed behaviour, without editing the plugin’s files.
- Built as a companion plugin, so updates never wipe it
- Exact quote before we start
- Tested on staging, then deployed
Typical turnaround: 3–7 business days
Choose thisNot sure which fits? Describe what you need and we’ll suggest the simplest option.
Can't find the right hook?
We can build the customisation for you. Describe what you need: