BetterShield 1.1.10 has 19 actions and 89 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 BetterShield fires an action
add_action( 'bettershield_two_factor_changed', function( $ID ) {
// Your code runs here.
}, 10, 1 );
// Change a value BetterShield is about to use
add_filter( 'bettershield_passkey_availability', function( $answer ) {
// Change $answer here.
return $answer;
}, 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.
Changes by version
1.1.9 → 1.1.10 · Nov 19, 2026 · 4 added, 0 removed
Added
All hooks
-
/** * Invalidate conveniences vouched for by the previous factor. Pending * enrollment never fires this: the new factor must actually be armed. */ do_action( 'bettershield_two_factor_changed', (int) $user->ID ); -
/** * Whether this site can do passkeys, and why not when it cannot. */ apply_filters( 'bettershield_passkey_availability', $answer ); -
/** * Filters the roles an add-on requires two-factor of outside this plugin's own * policy. */ apply_filters( 'bettershield_two_factor_roles_required_elsewhere', array() ); -
/** * This filter is documented in wp-login.php */ apply_filters( 'login_redirect', $target, $redirect_to, $user ); -
/** * This action is documented in wp-includes/user.php */ do_action( 'wp_login', $user->user_login, $user ); -
/** * This filter is documented in wp-login.php */ apply_filters( 'admin_email_check_interval', 6 * MONTH_IN_SECONDS ); -
/** * Fires when the second screen accepted this sign-in, before any cookie is set * — the moment an add-on may note that this browser passed the second * factor. */ do_action( 'bettershield_2fa_passed', $user ); -
/** * Fires on the code screen, after the form and its links. */ do_action( 'bettershield_2fa_screen_after_form', $user_id ); -
/** * Fires on the code screen, before the form. The seam for anything that * dresses this plugin's own sign-in screens. */ do_action( 'bettershield_2fa_screen_before_form', $user_id ); -
/** * Fires inside the code form, before its submit row — for a field an add-on * wants answered along with the code. */ do_action( 'bettershield_2fa_screen_form_fields', $user_id ); -
/** * How many days the activity log is kept, from thirty to 365. Anything outside * that range is held to its nearer end. */ apply_filters( 'bettershield_activity_retention_days', Pruner::RETENTION_DAYS ); -
/** * Checks an add-on runs with the audit. Each has the shape of the ones in * `Checks::all()`: a group from `Support\Areas`, a title, a severity, why it * matters, what fixing it could break, and a test that returns null when it * passes, evidence when it does not, or a WP_Error when it cannot tell. An * add-on check has no hardening item. */ apply_filters( 'bettershield_addon_checks', array() ); -
/** * The app is on this screen. An add-on that draws a section into the app's * slot enqueues its own script and style here — on every screen the app runs * on, not only its own page — because the app moves between sections without * a document load, so a bundle that only arrives with its own page never * arrives at all when the reader comes from another section. */ do_action( 'bettershield_admin_assets', $hook ); -
/** * Filters the published ranges an assistant platform calls out from, each * platform counted as one network. */ apply_filters( 'bettershield_agent_provider_ranges', self::PROVIDERS ); -
/** * How many requests carrying a refusal, inside the window, raise the louder * event. Zero or less switches the escalation off entirely and leaves the * individual refusals in the log and the digest. */ apply_filters( 'bettershield_agent_refusal_threshold', self::REPEAT_THRESHOLD ); -
/** * The event types that email even while instant alerts are off. */ apply_filters( 'bettershield_always_email_types', array( 'canary_used', 'maintenance_window_booked' ) ); -
/** * How many credentials one run may look at. */ apply_filters( 'bettershield_app_password_sweep_max', self::SWEEP_MAX ); -
/** * How long one run may spend, in seconds. */ apply_filters( 'bettershield_app_password_sweep_seconds', self::SWEEP_SECONDS ); -
/** * After the line was handed to the system log. */ do_action( 'bettershield_auth_log_line', $line ); -
/** * The security plugins the Quick Setup's coexistence check found. */ apply_filters( 'bettershield_coexisting_plugins', $found ); -
/** * How many days since a plugin's last update in the WordPress.org directory * before it is named. Never less than a year. */ apply_filters( 'bettershield_directory_stale_days', self::DEFAULT_STALE_DAYS ); -
/** * Filters the measured volumes. */ apply_filters( 'bettershield_disk_space', $volumes ); -
/** * How many days without a sign-in makes a privileged account dormant. */ apply_filters( 'bettershield_dormant_days', self::DEFAULT_DAYS ); -
/** * Names an object this plugin has no name for: an add-on's setting by what its * screen calls it, rather than by the option that holds it, and what the save * changed where the row records it. The activity log, the alert email and * "Since you last looked" all show it. */ apply_filters( 'bettershield_event_object_label', null, $event, $type, $id, $context ); -
/** * Filters the event types other plugins record through this plugin's activity * log. */ apply_filters( 'bettershield_event_types', array() ); -
/** * Drain bounded add-on aggregates through this writer at shutdown. Listeners * may buffer completed summaries, but must not call flush(). */ do_action( 'bettershield_events_before_flush' ); -
/** * Fires after a batch of activity events has been written. */ do_action( 'bettershield_events_flushed', $events, $context ); -
/** * How many explanations one account may ask for in an hour. */ apply_filters( 'bettershield_explain_budget_per_hour', self::MAX_PER_HOUR ); -
/** * Filters whether a guest comment that arrived without the bot check's fields * owes them. */ apply_filters( 'bettershield_honeypot_comment_owes_fields', ! $framed, is_array( $comment ) ? $comment : array() ); -
/** * Filters whether a guest contact-form submission that arrived without the bot * check's fields owes them, for a form drawn somewhere this plugin can't * reach. */ apply_filters( 'bettershield_honeypot_form_owes_fields', true, $surface ); -
/** * Filters whether a signed-out lost-password request that arrived without the * bot check's fields owes them. */ apply_filters( 'bettershield_honeypot_reset_owes_fields', true, $core ? 'core' : 'store' ); -
/** * Options an add-on reads on a request a visitor makes. */ apply_filters( 'bettershield_hot_options', array() ); -
/** * The hub address this site is pinned to, from `BETTERSHIELD_HUB_URL` in * wp-config.php unless something else answers. '' leaves the default in place. */ apply_filters( 'bettershield_hub_url', defined( 'BETTERSHIELD_HUB_URL' ) ? (string) constant( 'BETTERSHIELD_HUB_URL' ) : '' ); -
/** * How many days handled incidents are kept, from thirty to 180. Open incidents * never expire. Anything outside the range is held to its nearer end. */ apply_filters( 'bettershield_incident_history_days', \BetterShield\Database\Pruner::RETENTION_DAYS ); -
/** * Filters how long one request may spend comparing incoming packages against * their published copies. */ apply_filters( 'bettershield_incoming_budget', self::MAX_SECONDS ); -
/** * The project the usage report is filed under. Return an empty string to * switch reporting off for this build whatever the owner answers. */ apply_filters( 'bettershield_insights_item_id', $id ); -
/** * Filters how long one integrity tick may spend. */ apply_filters( 'bettershield_integrity_budget', self::DEFAULT_BUDGET_SECONDS ); -
/** * Filters how many files are hashed between clock checks. */ apply_filters( 'bettershield_integrity_chunk', self::DEFAULT_CHUNK ); -
/** * Filters how many files one unpublished location is walked for. */ apply_filters( 'bettershield_integrity_max_files', self::MAX_FILES ); -
/** * Filters what the integrity check looks at. */ apply_filters( 'bettershield_integrity_targets', $targets ); -
/** * Filters how many files one target's walk enumerates. */ apply_filters( 'bettershield_integrity_walk_limit', self::DEFAULT_WALK_LIMIT ); -
/** * Filters whether the site is treated as live. */ apply_filters( 'bettershield_is_production', $production ); -
/** * Fires after the sign-in address is applied, changed or undone. Runs while * the change is still held, so don't apply or undo another protection from * here. */ do_action( 'bettershield_login_address_changed', $new, $old ); -
/** * Filters how long failed sign-ins from one source are coalesced into one * logged event. */ apply_filters( 'bettershield_login_failure_window', 5 * MINUTE_IN_SECONDS ); -
/** * Filters the base the sign-in address is built on and answered at, for a site * that serves it under a language prefix, say. */ apply_filters( 'bettershield_login_home_url', $home ); -
/** * Filters whether a path the moved sign-in page closes stays closed. Asked * only for those paths, and never for the chosen address. Return false to keep * a path open; on /wp-login.php that reopens the old address. */ apply_filters( 'bettershield_login_refuse', true, self::request_path() ); -
/** * Filters where someone already signed in goes from the sign-in address. Sent * with wp_safe_redirect(), so it has to be on this site. */ apply_filters( 'bettershield_login_signed_in_redirect', $to, get_current_user_id() ); -
/** * The limits on registration and on the token endpoint. */ apply_filters( 'bettershield_mcp_anonymous_rate_limit', array( self::DEFAULT_MAX_REGISTRATIONS, self::DEFAULT_ANONYMOUS_WINDOW_SECONDS, self::DEFAULT_MAX_TOKEN_FAILURES, self::DEFAULT_MAX_TOKEN_ISSUES, ) ); -
/** * The setup instruction shown on the connection screen. */ apply_filters( 'bettershield_mcp_prompt', implode( "\n", $lines ) ); -
/** * The failed-authentication limit at the assistant endpoint. */ apply_filters( 'bettershield_mcp_rate_limit', array( $max, $window ) ); -
/** * How many sites the network overview reads per page. */ apply_filters( 'bettershield_network_page_size', self::MAX_SITES ); -
/** * How many refusals inside the window raise the louder event. Zero or less * switches the escalation off and leaves the first refusal of each window as * the only record. */ apply_filters( 'bettershield_passkey_refusal_threshold', self::REPEAT_THRESHOLD ); -
/** * Whether this person may remove their own passkey. Counted while holding the * account claim, so a second removal cannot reuse it. */ apply_filters( 'bettershield_passkey_self_remove_allowed', true, $user, count( $rows ) ); -
/** * The whole ledger, for an add-on that keeps something about a person too. An * entry carries `what`, `why`, `window` and `on_erasure`, and `kept_because` * when an erasure keeps it; its key is the storage. */ apply_filters( 'bettershield_personal_data_records', self::own_records() ); -
/** * The meta keys a network stores once per site, for an add-on that keeps a * per-site record of its own. An entry is a user meta key as the add-on writes * it on a single site; the site's id is appended to it on a network, here and * wherever the add-on reads it back. An add-on that declares the scoped name * instead is naming a key that exists on a network and nowhere else. */ apply_filters( 'bettershield_personal_data_site_scoped_meta', self::SITE_SCOPED_META ); -
/** * Short-circuits one DNS lookup. */ apply_filters( 'bettershield_pre_dns_lookup', null, $name, $type ); -
/** * Short-circuits the self-check, for a host that cannot reach itself over * plain HTTP from PHP and for the tests: null or a reason, as probe() answers. */ apply_filters( 'bettershield_pre_https_redirect_probe', false ); -
/** * Short-circuits the loopback, for a host that cannot reach itself and for the * tests: an array of extensions, or null for unknown. */ apply_filters( 'bettershield_pre_upload_types', false, $account ); -
/** * Filters the read-only abilities an add-on adds under `bettershield/`. */ apply_filters( 'bettershield_read_abilities', array() ); -
/** * Filters how long failed recovery attempts are coalesced into one logged * event. */ apply_filters( 'bettershield_recovery_failure_window', 5 * MINUTE_IN_SECONDS ); -
/** * Filters where a registration form's bot checks are rendered. */ apply_filters( 'bettershield_registration_form_hooks', array( 'register_form', 'woocommerce_register_form' ) ); -
/** * Filters where a lost-password form's bot checks are rendered. */ apply_filters( 'bettershield_reset_form_hooks', array( 'lostpassword_form', 'woocommerce_lostpassword_form' ) ); -
/** * Filters how many events of one type an hour holds before sampling. */ apply_filters( 'bettershield_sampling_threshold', self::DEFAULT_THRESHOLD ); -
/** * Filters how many of a day's rows are read at once while sealing. */ apply_filters( 'bettershield_seal_batch', self::BATCH ); -
/** * Whether this sign-in must still pass the second screen. */ apply_filters( 'bettershield_second_factor_required', $required, $user, $proof ); -
/** * Sections an add-on adds to this plugin's menu, drawn inside the same chrome. * Each entry: label, capability, tabs (slug => label), and optionally how the * sidebar lists them. The sidebar gives each add-on section a zone of its own, * headed by its label, below this plugin's screens: nav_groups names the * zone's groups in order (key => heading, an empty heading for a group that * needs none), nav_marks... */ apply_filters( 'bettershield_sections', array() ); -
/** * Settings an add-on keeps, so that changing them is undoable here too. */ apply_filters( 'bettershield_settings_ledger_surfaces', array() ); -
/** * Filters where a sign-in form's bot checks are rendered. */ apply_filters( 'bettershield_sign_in_form_hooks', array( 'login_form', 'woocommerce_login_form' ) ); -
/** * What each answer would do, for an add-on that stops something of its own on * a staging copy to say so before the answer is given. */ apply_filters( 'bettershield_site_identity_plan', $plan ); -
/** * Fires when a scheduled task's run has ended, however it was started. */ do_action( 'bettershield_task_finished', $hook, $outcome, $started, $seconds ); -
/** * Names an add-on's scheduled tasks, by hook. */ apply_filters( 'bettershield_task_labels', array() ); -
/** * The tier this site is on. A paid add-on answers 'ultra' while it is active; * anything else is the free tier. */ apply_filters( 'bettershield_tier', self::FREE ); -
/** * How many days before a two-factor deadline its account is emailed, once. * Zero sends nothing. */ apply_filters( 'bettershield_two_factor_reminder_days', self::DAYS_BEFORE ); -
/** * Whether this person may turn their own second factor off. An add-on that * requires it for their role answers false; an administrator's disable_for() * is not asked. */ apply_filters( 'bettershield_two_factor_self_disable_allowed', true, $user ); -
/** * Whether another security plugin has two-factor set up for an account, where * BetterShield does not know where it keeps that. */ apply_filters( 'bettershield_two_factor_set_up_elsewhere', false, $file, $user_id ); -
/** * This filter is documented in wp-includes/user.php */ apply_filters( 'illegal_user_logins', array() ); -
apply_filters( 'bettershield_safe_mode_duration', HOUR_IN_SECONDS ); -
apply_filters( 'bettershield_agent_propose_limit', Registrar::PROPOSE_LIMIT_PER_HOUR ); -
apply_filters( 'bettershield_agent_write_limit', Registrar::WRITE_LIMIT_PER_HOUR ); -
do_action( 'wp_login_failed', $user->user_login, $allowed ); -
apply_filters( 'authenticate', $user, $user->user_login, '' ); -
apply_filters( 'automatic_updater_disabled', false ); -
apply_filters( 'bettershield_backup_plugins', array( 'updraftplus' => 'UpdraftPlus', 'backwpup' => 'BackWPup', 'duplicator' => 'Duplicator', 'backwpup-pro' => 'BackWPup Pro', 'duplicator-pro' => 'Duplicator Pro', 'all-in-one-wp-migration' => 'All-in-One WP Migration and Backup', 'wpvivid-backuprestore' => 'WPvivid Backup', 'jetpack-backup' => 'Jetpack VaultPress Backup', 'blogvault-real-time-backup' => 'BlogVault', 'backup-backup' => 'Back... ); -
apply_filters( 'bettershield_guard_cap', self::MAX_GUARDS ); -
apply_filters( 'bettershield_intelligence_endpoint', self::ENDPOINT ); -
do_action( 'bettershield_log_resealed', (string) $why, $days, $result ); -
do_action( 'bettershield_maintenance_summary_ready' ); -
apply_filters( 'bettershield_own_refusals', array() ); -
apply_filters( 'bettershield_recovery_link_lifetime', self::LIFETIME ); -
apply_filters( 'bettershield_request_volume_types', array() ); -
apply_filters( 'bettershield_seal_grace', HOUR_IN_SECONDS ); -
apply_filters( 'bettershield_setup_deactivation_enabled', false ); -
apply_filters( 'bettershield_suspension_lift_hint', $default, $id, $row ? (string) $row->action_key : '' ); -
apply_filters( 'bettershield_suspension_lift_path', '', $id, (string) $row->action_key ); -
apply_filters( 'bettershield_vulnerability_feed', null ); -
apply_filters( 'bettershield_write_abilities', array() ); -
apply_filters( 'bettershield_write_deactivation_enabled', defined( 'BETTERSHIELD_WRITE_DEACTIVATION' ) && BETTERSHIELD_WRITE_DEACTIVATION ); -
apply_filters( 'pre_update_option', $clean, $name, $old ); -
apply_filters( "pre_update_option_{$name}", $clean, $old, $name ); -
apply_filters( 'rank_math/sitemap/author/slug', 'author' ); -
apply_filters( 'session_token_manager', 'WP_User_Meta_Session_Tokens' ); -
apply_filters( 'the_generator', get_the_generator( $type ), $type ); -
do_action( 'update_option', $name, $old, $value ); -
do_action( "update_option_{$name}", $old, $value, $name ); -
do_action( 'updated_option', $name, $old, $value ); -
apply_filters( 'woocommerce_prevent_admin_access', $prevent ); -
apply_filters( 'xmlrpc_enabled', true );
Generated from BetterShield'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: