Loyal Security icon
Security

Loyal Security hooks reference

Loyal Security 1.6.0 has 15 actions and 56 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.

functions.phpyour child theme
// Run your own code when Loyal Security fires an action
add_action( 'loyalsec_ban_removed', function( $ip ) {
	// Your code runs here.
}, 10, 1 );

// Change a value Loyal Security is about to use
add_filter( 'https_local_ssl_verify', function( $value ) {
	// Change $value here.
	return $value;
}, 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

  • src/Modules/Firewall/BanStore.php line 385 · used in 3 places
    /**
     * Fires after a ban is removed. Used by integrations that mirror the ban list
     * elsewhere (the web-server ban block, Cloudflare sync).
     */
    do_action( 'loyalsec_ban_removed', $ip );
  • src/Modules/Audit/Logger.php line 107 · used in 3 places
    /**
     * Fires after an event is logged. Used for real-time alerting/notifications.
     */
    do_action( 'loyalsec_event_logged', $type, $data, $id );
  • src/Support/Http.php line 53
    /**
     * This filter is documented in wp-includes/class-wp-http-streams.php
     */
    apply_filters( 'https_local_ssl_verify', false );
  • src/Modules/Backup/BackupModule.php line 425
    /**
     * Fires after backup retention has been enforced (extension point for add-ons
     * that keep data of their own alongside backups).
     */
    do_action( 'loyalsec_backup_retention_enforced' );
  • src/Modules/Firewall/BanStore.php line 358
    /**
     * Fires after a ban is added or updated. Used by integrations (e.g. Cloudflare
     * sync) to mirror the ban to an external edge firewall.
     */
    do_action( 'loyalsec_ban_added', (string) $ban['ip'], array( 'reason' => (string) $ban['reason'], 'type' => (string) $ban['type'], 'source' => (string) $ban['source'], 'cidr' => (string) $ban['cidr'], ) );
  • src/Plugin.php line 123
    /**
     * Fires after Loyal Security has fully booted.
     */
    do_action( 'loyalsec_booted', $this );
  • src/Support/Brand.php line 26
    /**
     * Filters the product name shown in the dashboard, admin menu, admin bar,
     * alert emails and passkey prompts.
     */
    apply_filters( 'loyalsec_brand_name', self::NAME );
  • src/Modules/Auth/BreachCheck.php line 71
    /**
     * Filters whether the breached-password check runs.
     */
    apply_filters( 'loyalsec_breach_check_enabled', true, (int) $user_id );
  • src/Modules/Integrity/ChecksumCache.php line 247
    /**
     * Filters how many checksum files the cache folder may hold.
     */
    apply_filters( 'loyalsec_checksum_cache_max_files', self::MAX_FILES );
  • src/Modules/Scanner/ScannerModule.php line 1061
    /**
     * Fires alongside `loyalsec_scan_finding` for each newly recorded finding.
     */
    do_action( 'loyalsec_cloud_reputation_scanner', $f );
  • src/Modules/Firewall/FirewallModule.php line 902
    /**
     * Fires on a WAF signature or virtual-patch block.
     */
    do_action( 'loyalsec_cloud_reputation_waf', $type, $context );
  • src/Rest/Controllers/CspController.php line 732
    /**
     * Filters whether a Google country site is added automatically while the
     * Google Analytics service is on.
     */
    apply_filters( 'loyalsec_csp_auto_allow_google_domains', true, $host, $dir );
  • src/Rest/Controllers/CspController.php line 459
    /**
     * Seconds during which a repeat of one violation is only counted, not written.
     */
    apply_filters( 'loyalsec_csp_report_interval', CspReportThrottle::INTERVAL );
  • src/Modules/ThreatIntel/VulnerabilityScanner.php line 361
    /**
     * Whether to report a CVE that carries no usable version information (can't be
     * confirmed to affect the installed version). Default false = drop it as junk.
     */
    apply_filters( 'loyalsec_cve_report_without_version', false, $cve, $installed );
  • src/Modules/Scanner/DatabaseScanner.php line 142
    /**
     * Filters the hosts the database scan accepts in a stored <script src> or
     * <iframe src>. A host also covers its subdomains.
     */
    apply_filters( 'loyalsec_db_scan_allowed_hosts', $hosts );
  • src/Modules/Scanner/DatabaseScanner.php line 302
    /**
     * Filters which parts of the database the content scan reads. Each entry is
     * one source: posts, postmeta, terms, termmeta, options, comments, usermeta,
     * snippets, site_address, admins. They always run in that order; unknown
     * entries are ignored.
     */
    apply_filters( 'loyalsec_db_scan_sources', self::SOURCES );
  • src/Modules/Scanner/ScannerModule.php line 732
    /**
     * Filters how many seconds one scan call spends on the database phase before
     * it hands back (it always completes the window it is reading).
     */
    apply_filters( 'loyalsec_db_scan_step_seconds', self::DB_STEP_SECONDS );
  • src/Modules/Integrity/CoreChecksums.php line 68
    /**
     * Filters the files in the WordPress root that are expected although they are
     * not part of WordPress, such as an analytics endpoint a plugin writes there.
     */
    apply_filters( 'loyalsec_expected_root_files', $files );
  • src/Modules/ThreatIntel/FeedStore.php line 104
    /**
     * Fires after ANY feed dataset is written to the cache — distinct from the
     * cve-only `loyalsec_feed_updated` hook below. Consumers that care about a
     * specific dataset (e.g. FirewallModule refreshing the prepend's config
     * snapshot after a 'waf'/'patches' sync) should filter on $dataset themselves.
     */
    do_action( 'loyalsec_feed_dataset_updated', $dataset, $rules );
  • src/Modules/ThreatIntel/FeedStore.php line 117
    /**
     * Fires after a CVE advisory dataset is written to the feed cache.
     */
    do_action( 'loyalsec_feed_updated', $rules );
  • src/Core/Installer.php line 478
    /**
     * Filters how many rows `scan_findings` may hold for its index to be added
     * during a request.
     */
    apply_filters( 'loyalsec_findings_index_inline_rows', self::INLINE_ROWS );
  • src/Core/Installer.php line 556
    /**
     * Filters how many seconds the index build may wait for a lock on the table.
     */
    apply_filters( 'loyalsec_findings_index_lock_wait', $deferred ? 60 : 5, $deferred );
  • src/Core/HealthScore.php line 106
    /**
     * Filters the health-score checks before the score is totalled.
     */
    apply_filters( 'loyalsec_health_score_checks', $checks );
  • src/Modules/Audit/IncidentCorrelator.php line 161
    /**
     * Filter the computed incident score for a cluster.
     */
    apply_filters( 'loyalsec_incident_score', $score, $events );
  • src/Modules/Integrity/IntegrityModule.php line 937
    /**
     * Filters how many seconds one slice of an integrity job works (never more
     * than 60).
     */
    apply_filters( 'loyalsec_integrity_slice_seconds', $default, $context );
  • src/Rest/Controllers/LogsController.php line 139
    /**
     * Filter the event types shown by the free live traffic monitor.
     */
    apply_filters( 'loyalsec_live_event_types', $types );
  • src/Modules/Audit/LogRepository.php line 244
    /**
     * Filters the audit log's row cap. 0 turns the cap off.
     */
    apply_filters( 'loyalsec_log_max_rows', self::DEFAULT_MAX_ROWS );
  • src/Modules/Hardening/HardeningModule.php line 248
    /**
     * Filters the login error codes shown as they are, because they say nothing
     * about whether the account exists or the password was right.
     */
    apply_filters( 'loyalsec_login_error_codes_shown', array( 'empty_username', 'empty_password', 'test_cookie', 'loyalsec_captcha', 'loyalsec_banned', 'loyalsec_login_locked' ) );
  • src/Modules/Hardening/HardeningModule.php line 263
    /**
     * Filters extra notes appended to the neutral "Incorrect username or password"
     * message, for example how to finish a two-factor sign-in. Notes must not
     * depend on whether the password was right, or they would reveal it.
     */
    apply_filters( 'loyalsec_login_error_notes', array(), self::$failed_login );
  • src/Modules/Firewall/BruteForce.php line 166
    /**
     * Fires on every failed login, after it is recorded.
     */
    do_action( 'loyalsec_login_failed', $ip, (string) $username );
  • src/Modules/Firewall/BruteForce.php line 130
    /**
     * Filters the login error codes that are not counted as failed logins (prompts
     * such as "enter your code", rather than wrong credentials).
     */
    apply_filters( 'loyalsec_login_failure_ignored_codes', self::NOT_FAILURES );
  • src/Modules/Notifications/Dispatcher.php line 211
    /**
     * Filters whether an event is emailed. An add-on that already sends its own,
     * more specific email for an event can return false here so the owner gets one
     * email, not two.
     */
    apply_filters( 'loyalsec_notification_email', true, $type, $data, $severity );
  • src/Modules/Notifications/Dispatcher.php line 118
    /**
     * Fires for every event that passed the mute list, after the email channel
     * ran, so an add-on can deliver it through channels of its own.
     */
    do_action( 'loyalsec_notification_event', array( 'type' => $type, 'data' => $data, 'severity' => $severity, 'guide' => $guide, 'id' => $id ), $this->module );
  • src/Modules/Notifications/Dispatcher.php line 92
    /**
     * Filters whether an event whose audit row could not be written is still
     * notified.
     */
    apply_filters( 'loyalsec_notify_unrecorded_event', true, $type, $data, $severity );
  • src/Core/OnboardingChecklist.php line 86
    /**
     * Filters the onboarding steps after their done-state has been evaluated.
     */
    apply_filters( 'loyalsec_onboarding_steps', $steps );
  • src/Core/ProStatus.php line 31
    /**
     * Filters whether the Loyal Security Pro plugin is active. Pro hooks this;
     * nothing in the free plugin sets it.
     */
    apply_filters( 'loyalsec_pro_active', false );
  • src/Modules/Incident/RepairBackup.php line 414
    /**
     * Fires after a repair backup is recorded. Lets the incident module check
     * whether the accumulated backup storage has crossed the admin-reminder
     * threshold.
     */
    do_action( 'loyalsec_repair_backup_recorded', $entry );
  • src/Modules/Backup/RestoreEngine.php line 89
    /**
     * Filters the result of a completed restore (extension point, e.g. to replay
     * data recorded after the backup was taken).
     */
    apply_filters( 'loyalsec_restore_result', $result, $manifest );
  • src/Modules/Scanner/ScannerModule.php line 1435
    /**
     * Filters whether the built-in weekly scan runs. An add-on that schedules its
     * own, more frequent scans can return false to avoid scanning twice.
     */
    apply_filters( 'loyalsec_run_weekly_scan', true );
  • src/Modules/Scanner/ScannerModule.php line 997
    /**
     * Filters how many `scan.finding` audit rows one scan may write. Every row
     * counts, critical ones included. Once the limit is reached only critical
     * findings are still written (severity critical, or a score of 30 and over,
     * which is what telemetry treats as critical), so 0 writes critical findings
     * only. The rows are not the findings: all of them are stored and fire the
     * actions, and `scan.completed` ...
     */
    apply_filters( 'loyalsec_scan_audit_rows_per_scan', self::AUDIT_ROWS_PER_SCAN );
  • src/Modules/Scanner/ScannerModule.php line 587
    /**
     * Filters the share of time (0.1 to 1.0) a scan driver spends working; it
     * waits for the rest. 1.0 turns the waiting off.
     */
    apply_filters( 'loyalsec_scan_duty_cycle', self::DUTY_CYCLE );
  • src/Modules/Scanner/ScannerModule.php line 1052
    /**
     * Fires once for each newly-recorded scan finding.
     */
    do_action( 'loyalsec_scan_finding', $f );
  • src/Modules/Scanner/ScannerModule.php line 306
    /**
     * Filters the 1-minute load average above which the background scan waits
     * instead of working. 0 (the default) turns the check off.
     */
    apply_filters( 'loyalsec_scan_max_load', 0.0 );
  • src/Rest/Controllers/ScannerController.php line 105
    /**
     * Filters how many seconds of scanning one dashboard request does (paced;
     * never more than 60).
     */
    apply_filters( 'loyalsec_scan_slice_seconds', 8.0 );
  • src/Modules/Scanner/TrustedFiles.php line 43
    /**
     * Filters the files the malware scanner trusts without scanning.
     */
    apply_filters( 'loyalsec_scanner_trusted_files', $map );
  • src/Modules/Firewall/FirewallModule.php line 585
    /**
     * Filters the addresses treated as this server, which skip the firewall's rate
     * and query-cardinality limits (bans and content checks still apply).
     */
    apply_filters( 'loyalsec_server_ips', $ips );
  • src/Modules/ThreatIntel/ThreatIntelModule.php line 61
    /**
     * Filters whether the vulnerability warnings are shown on the Plugins screen
     * (and the network Themes screen). Decided on `admin_init` at priority 10, so
     * add the filter before then.
     */
    apply_filters( 'loyalsec_show_vuln_row_notices', $show );
  • src/Core/Cron.php line 118
    /**
     * Filters the threat-intelligence sync schedule.
     */
    apply_filters( 'loyalsec_threatintel_sync_recurrence', 'twicedaily' );
  • src/Modules/Firewall/FirewallModule.php line 813
    /**
     * An allowed-but-suspicious ("near miss") request: it scored on the WAF but
     * stayed below the block threshold, so it is being let through. The
     * bypass-telemetry module subscribes (only when the admin has opted in) to
     * record an anonymized snapshot, so that if this request later proves to have
     * planted malware we can report exactly what slipped past the firewall. No-op
     * when nothing is listening.
     */
    do_action( 'loyalsec_waf_near_miss', $req, $decision );
  • src/Modules/Hardening/XmlRpcGuard.php line 76
    /**
     * Filters whether XML-RPC stays reachable even though "Disable XML-RPC" is on,
     * because another plugin needs it. Pingbacks and system.multicall stay
     * disabled either way.
     */
    apply_filters( 'loyalsec_xmlrpc_needed', $needed );
  • src/Modules/Firewall/FirewallModule.php line 407 · used in 3 places
    apply_filters( 'loyalsec_auto_whitelist_ttl', 30 * DAY_IN_SECONDS );
  • src/Modules/Auth/LoginUrlGuard.php line 168
    apply_filters( 'auth_redirect_scheme', '' );
  • src/Modules/Firewall/FirewallModule.php line 408
    apply_filters( 'loyalsec_auto_whitelist_max', 25 );
  • src/Modules/Backup/BackupModule.php line 347
    apply_filters( 'loyalsec_backup_min_free_bytes', max( self::MIN_FREE_BYTES, (int) ( $largest * 1.5 ) ), $largest );
  • src/Core/StorageBounds.php line 154
    apply_filters( 'loyalsec_baseline_orphan_grace_seconds', self::ORPHAN_GRACE );
  • src/Core/StorageBounds.php line 141
    apply_filters( 'loyalsec_baseline_orphan_sweep', false );
  • src/Core/StorageBounds.php line 83
    apply_filters( 'loyalsec_closed_findings_max_rows', self::FINDINGS_MAX );
  • src/Core/StorageBounds.php line 67
    apply_filters( 'loyalsec_closed_findings_retention_days', self::CLOSED_DAYS );
  • src/Core/StorageBounds.php line 71
    apply_filters( 'loyalsec_csp_violations_max_rows', self::CSP_MAX );
  • src/Core/Cron.php line 191
    apply_filters( 'loyalsec_csp_violations_retention_days', 90 );
  • src/Modules/ThreatIntel/SignatureVerifier.php line 64
    apply_filters( 'loyalsec_feed_public_key', $key_b64 );
  • src/Modules/ThreatIntel/ThreatIntelModule.php line 466
    apply_filters( 'loyalsec_feed_stale_seconds', 3 * DAY_IN_SECONDS );
  • src/Modules/ThreatIntel/FeedClient.php line 56
    apply_filters( 'loyalsec_feed_url', LicenseKit::feed_url() );
  • src/Modules/Integrity/IntegrityModule.php line 1360
    apply_filters( 'loyalsec_integrity_duty_cycle', self::DUTY_CYCLE );
  • src/Modules/Integrity/IntegrityJob.php line 762
    do_action( 'loyalsec_integrity_job_lost', $cur );
  • src/Modules/Audit/LogRepository.php line 230
    apply_filters( 'loyalsec_log_retention_days', 90 );
  • src/Core/StorageBounds.php line 70
    apply_filters( 'loyalsec_login_attempts_max_rows', self::LOGIN_ATTEMPTS_MAX );
  • src/Core/Cron.php line 180
    apply_filters( 'loyalsec_login_attempts_retention_days', 30 );
  • src/Core/StorageBounds.php line 72
    apply_filters( 'loyalsec_notifications_max_rows', self::NOTIFICATIONS_MAX );
  • src/Modules/Incident/RepairBackup.php line 389
    apply_filters( 'loyalsec_repair_backups_max_bytes', self::MAX_BYTES );
  • src/Modules/Auth/TrustedDevice.php line 56
    apply_filters( 'loyalsec_trusted_device_ttl', self::COOKIE_TTL, $user_id );

Generated from Loyal Security'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.

Plugin 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 this

Not 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: