Controlling Logtivity With Filters

It is possible to use filters to control the Logtivity plugin and how it connects to the Logtivity app. This allows you to use code to manage Logtivity’s settings on one or multiple sites.

These filters can be placed in your theme’s functions.php file or you can add them with a custom plugin.

This filter allows you to add your Logtivity API key:

add_filter('logtivity_site_api_key', function() {
	return '';
});

These next filters allow you to modify the settings inside the Logtivity plugin. Choose true or false to either enable or disable each setting.

add_filter('logtivity_disable_default_logging', function() {
	return false;
});

add_filter('logtivity_should_store_user_id', function() {
	return true;
});

add_filter('logtivity_should_store_ip', function() {
	return true;
});

add_filter('logtivity_should_log_profile_link', function() {
	return true;
});

add_filter('logtivity_should_log_username', function() {
	return true;
});

add_filter('logtivity_enable_debug_mode', function() {
	return false;
});

Finally, you can use these two filters to hide the “Settings” page and even the logs page to almost completely remove Logtivity from the WordPress admin area. The only place Logtivity would then show is in the “Plugins” list.

add_filter('logtivity_hide_settings_page', function() {
	return false;
});

add_filter('logtivity_hide_from_menu', function() {
	return false;
});