Privacy and Reference
Logify Hooks and Filters — Developer Reference
What is it?
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. Everything on this page belongs in a site-specific plugin or your theme's functions.php.
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_trackable_object_types
The object types Logify is willing to record.
kc_lf_failed_login_threshold and kc_lf_failed_login_window
Brute-force detection. The threshold is how many failed logins from one IP count as a burst; the window is the period they must fall within.
// 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 );
Storage and performance
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_dashboard_cache_ttl
How long the dashboard statistics are cached. Defaults to 5 minutes.
add_filter( 'kc_lf_dashboard_cache_ttl', fn() => 15 * MINUTE_IN_SECONDS );
kc_lf_export_max_rows
Upper bound on the number of rows a single export will produce.
kc_lf_enable_auto_update_db
Return false to stop Logify running database updates automatically, if you prefer to trigger them during a controlled deployment.
IP address and country
| Filter | Purpose |
|---|---|
kc_lf_trust_country_headers |
Trust a CDN-supplied country header. Off by default. |
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. |
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. |
kc_lf_trust_proxy_headers |
Whether to read the client IP from proxy headers. |
These are covered in detail in How Logify Determines IP Address and Country.
Sessions (PRO)
kc_lf_idle_session_expiration_window
How long a session may go without activity before the hourly cleanup marks it expired.
Dashboard, digest and notifications
| Filter | Purpose |
|---|---|
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 notification destinations (PRO). |
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_admin_menu |
While the Logify admin menu is being built, for adding your own submenu page. |
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 );
}
} );
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 LogManger::log().
If you are adding events, pick an ID from a free range — the ranges already in use are listed in Logify Event Reference.