Privacy and Reference
Logify Hooks and Filters — Developer Reference
Logify exposes WordPress filters and actions so you can change what gets logged, how it is stored, and how it is presented without editing the plugin. This page lists every documented hook with its purpose, plus the one REST route Logify registers. Put your code in a site-specific plugin or your theme's functions.php.
Logify registers no shortcodes and no blocks. It exposes one REST route (documented below) and the filters and actions on this page.
Controlling what gets logged
kc_lf_should_log
The final say on whether an entry is written. Runs after the Exclusion Rules have been applied, so you can add logic the settings screen cannot express.
add_filter( 'kc_lf_should_log', function ( $should_log, $data ) {
// Never log activity from a scheduled import user.
if ( isset( $data['user_login'] ) && 'importer' === $data['user_login'] ) {
return false;
}
return $should_log;
}, 10, 2 );
kc_lf_tracked_options
The list of WordPress options that produce a "Setting Changed" entry. Add your own to watch a setting Logify does not track by default.
add_filter( 'kc_lf_tracked_options', function ( $options ) {
$options[] = 'my_plugin_api_mode';
return $options;
} );
kc_lf_failed_login_threshold and kc_lf_failed_login_window
Brute-force detection. The threshold is how many failed logins from one IP and username count as a burst (default 5); the window is the period they must fall within (default 5 minutes). Once the threshold is crossed, Logify records a single aggregated brute-force event instead of each failure.
// Flag a burst at 10 failures within 5 minutes.
add_filter( 'kc_lf_failed_login_threshold', fn() => 10 );
add_filter( 'kc_lf_failed_login_window', fn() => 5 * MINUTE_IN_SECONDS );
Other logging filters
| Filter | Purpose |
|---|---|
kc_lf_trackable_object_types |
The object types Logify is willing to record. |
kc_lf_yoast_tracked_fields |
Yoast SEO meta keys tracked on a post, as meta key => label. Add a key to track a field Logify does not watch, or remove one to ignore it. |
Storage and performance
| Filter | Purpose |
|---|---|
kc_lf_async_writes_enabled |
Log writes are buffered during the request and saved in one batched query on shutdown. Return false to write each entry immediately — useful when debugging, not recommended in production. |
kc_lf_export_max_rows |
Upper bound on the rows a single export produces. Default 50000. |
kc_lf_log_retention_days |
Overrides the Log Retention Period setting. Return 0 to keep entries indefinitely. |
kc_lf_enable_auto_update_db |
Return false to stop Logify running database schema updates automatically, if you prefer to trigger them during a controlled deployment. |
kc_lf_install_skip_create_files |
Skip creation of the plugin's helper files on install. |
// Keep three months of history regardless of the setting.
add_filter( 'kc_lf_log_retention_days', fn() => 90 );
IP address and country
| Filter | Purpose |
|---|---|
kc_lf_trust_country_headers |
Trust a CDN-supplied country header. Off by default. |
kc_lf_trust_proxy_headers |
Whether to read the client IP from proxy headers. |
kc_lf_geoip_database_path |
Path to a local MaxMind GeoLite2 country database. |
kc_lf_country_lookup_urls |
Online lookup endpoints, in order. Return an empty array to disable online lookups. |
kc_lf_country_lookup_timeout |
Timeout for an online lookup request. |
kc_lf_country_negative_cache_ttl |
How long a failed lookup is remembered before retrying. |
These are covered in detail in how Logify determines IP address and country.
Dashboard, digest and notifications
| Filter | Purpose |
|---|---|
kc_lf_dashboard_cache_ttl |
How long the dashboard statistics are cached. Defaults to 5 minutes. |
kc_lf_dashboard_stats |
The full dashboard statistics payload, before it is cached. PRO analytics are added on this filter. |
kc_lf_email_digest_data |
The data used to render the email digest. |
kc_lf_email_digest_subject |
The digest subject line. |
kc_lf_email_digest_recipients |
Who receives the digest. |
kc_lf_notification_destinations |
The registered real-time notification destinations. PRO |
add_filter( 'kc_lf_dashboard_cache_ttl', fn() => 15 * MINUTE_IN_SECONDS );
Sessions (PRO)
PRO feature
User Sessions is a Logify PRO feature, so this filter has no effect on the free edition.
| Filter | Purpose |
|---|---|
kc_lf_idle_session_expiration_window |
How long a session may go without activity before the hourly cleanup marks it expired. |
Admin interface
| Filter | Purpose |
|---|---|
kc_lf_admin_screens |
Screens treated as Logify screens, which controls where assets load. |
kc_lf_filter_activity_logs_columns |
Columns shown on the Activity Logs table. |
kc_lf_event_type_choices |
Choices in the Event Type filter. |
kc_lf_tools_tabs |
Tabs on the Tools screen. |
kc_lf_filter_settings_tab |
Tabs on the Settings screen. |
kc_lf_filter_general_maintenance_settings |
Fields in the General settings tab. |
kc_lf_filter_exclusion_settings |
Fields in the Exclusions settings tab. |
kc_lf_pro_upgrade_url |
Destination of upgrade and pricing links. |
kc_lf_utm_params |
Campaign parameters added to outbound links. |
kc_lf_can_show_promotion |
Return false to switch off in-plugin promotions site-wide. |
kc_lf_promo_campaigns |
The promotional campaigns available. Return an empty array to disable. |
kc_lf_promo_campaign |
A single resolved campaign, just before it is used. |
Actions
| Action | When it fires |
|---|---|
kc_lf_post_insert_activity_log |
After an activity log row is inserted. Fires for every row in both the buffered and immediate write paths, which makes it the right hook for forwarding events elsewhere. |
kc_lf_pre_insert_{event} / kc_lf_post_insert_{event} |
Before and after a specific event type is inserted, for targeting one kind of activity. |
kc_lf_admin_menu |
While the Logify admin menu is being built, for adding your own submenu page. |
kc_lf_after_retention_purge |
After the daily retention task runs. Receives the number of rows removed, the period applied, and the cut-off timestamp. |
kc_lf_tools_tab_{slug} |
Renders the body of a custom Tools screen tab you registered with kc_lf_tools_tabs. |
add_action( 'kc_lf_post_insert_activity_log', function ( $data ) {
// Forward high severity events to your own monitoring.
if ( isset( $data['severity'] ) && $data['severity'] >= 300 ) {
my_monitoring_client()->send( $data );
}
} );
REST endpoint
Logify registers a single REST route, available in the free edition:
| Method + route | Capability | Purpose |
|---|---|---|
POST logify/v1/email-digest/send-test |
manage_options |
Send a test copy of the email digest to confirm delivery. |
This backs the Send Test button on the Email Digest settings tab. There are no other public REST routes, and no shortcodes or blocks.
Adding your own event
Activity classes live in lite/includes/Activities/{Category}/{Action}.php, and PRO ones in pro/includes/Activities/{Category}/. A class extends BaseActivity, sets $event_id, $event_type, $action, and $severity, hooks a WordPress action in init(), and calls the logger. Trackers are auto-discovered by file, so a new class in the right folder is picked up automatically.
If you are adding events, pick an ID from a free range — the ranges already in use are listed in the Logify event reference.
Conclusion
These hooks let you decide what Logify records, tune performance and retention, control geolocation, and forward events to your own systems — all without touching plugin code. For the event IDs and severities you will reference from these hooks, see the event reference; to control logging from the command line, see managing logs with WP-CLI.
FAQs
Does Logify have any shortcodes or blocks?
No. Logify registers no shortcodes and no Gutenberg blocks. Its extensibility is through WordPress filters and actions, listed on this page, plus a single REST route (POST logify/v1/email-digest/send-test) that powers the digest test-send button. Add your customisations in a site-specific plugin or your theme's functions.php.
How do I stop Logify from recording certain activity in code?
Use the kc_lf_should_log filter, which runs after the Exclusion Rules and returns the final decision on whether an entry is written. Return false for the events you want to drop. For most cases the Exclusions settings tab is enough; use the filter when you need logic the settings screen cannot express, such as matching on the acting user's login.
How do I forward Logify events to another system?
Hook the kc_lf_post_insert_activity_log action, which fires after every row is inserted in both the buffered and immediate write paths. Inspect the $data array — including severity — and forward the events you care about to your monitoring or SIEM. Because it fires for every write path, it is the reliable place to mirror activity elsewhere.
Can I change how long logs are kept in code?
Yes. The kc_lf_log_retention_days filter overrides the Log Retention Period setting, so you can keep any number of days — for example 90 — even though the settings screen only offers 7 days, 30 days, or indefinite. Return 0 to keep entries indefinitely. The daily purge task honours the filtered value.
How do I add a custom activity type to Logify?
Create a class under lite/includes/Activities/{Category}/{Action}.php (or the pro/ equivalent) that extends BaseActivity, sets $event_id, $event_type, $action, and $severity, hooks a WordPress action in init(), and calls the logger. Choose an event ID from an unused range — see the event reference. Trackers are auto-discovered, so no registration is needed.