-
Home
-
WP Statistics – The Most Popular Privacy-Friendly Analytics Plugin
- Tips
How to Hide WP Statistics Admin Menus
function plt_hide_wp_statistics_menus() {
//Hide "Statistics".
remove_menu_page('wps_overview_page');
//Hide "Statistics → Overview".
remove_submenu_page('wps_overview_page', 'wps_overview_page');
//Hide "Statistics → Visitor Insights".
remove_submenu_page('wps_overview_page', 'wps_visitors_page');
//Hide "Statistics → Page Insights".
remove_submenu_page('wps_overview_page', 'wps_pages_page');
//Hide "Statistics → Referrals".
remove_submenu_page('wps_overview_page', 'wps_referrals_page');
//Hide "Statistics → Content Analytics".
remove_submenu_page('wps_overview_page', 'wps_content-analytics_page');
//Hide "Statistics → Author Analytics".
remove_submenu_page('wps_overview_page', 'wps_author-analytics_page');
//Hide "Statistics → Category Analytics".
remove_submenu_page('wps_overview_page', 'wps_category-analytics_page');
//Hide "Statistics → Geographic".
remove_submenu_page('wps_overview_page', 'wps_geographic_page');
//Hide "Statistics → Devices".
remove_submenu_page('wps_overview_page', 'wps_devices_page');
//Hide "Statistics →".
remove_submenu_page('wps_overview_page', 'wps_break_menu');
//Hide "Statistics → Add-Ons".
remove_submenu_page('wps_overview_page', 'wps_plugins_page');
//Hide "Statistics → Privacy Audit".
remove_submenu_page('wps_overview_page', 'wps_privacy-audit_page');
//Hide "Statistics → Settings".
remove_submenu_page('wps_overview_page', 'wps_settings_page');
//Hide "Statistics → Optimization".
remove_submenu_page('wps_overview_page', 'wps_optimization_page');
}
add_action('admin_menu', 'plt_hide_wp_statistics_menus', 11);
Where do I put this code?
How to Hide WP Statistics Dashboard Widgets
function plt_hide_wp_statistics_dashboard_widgets() {
$screen = get_current_screen();
if ( !$screen ) {
return;
}
//Remove the "Traffic Overview" widget.
remove_meta_box('wp-statistics-quickstats-widget', 'dashboard', 'normal');
//Remove the "Browser Usage" widget.
remove_meta_box('wp-statistics-browsers-widget', 'dashboard', 'normal');
//Remove the "Most Used Operating Systems" widget.
remove_meta_box('wp-statistics-platforms-widget', 'dashboard', 'normal');
//Remove the "Device Usage Breakdown" widget.
remove_meta_box('wp-statistics-devices-widget', 'dashboard', 'normal');
//Remove the "Top Device Model" widget.
remove_meta_box('wp-statistics-models-widget', 'dashboard', 'normal');
//Remove the "Top Countries" widget.
remove_meta_box('wp-statistics-countries-widget', 'dashboard', 'normal');
//Remove the "Top Referring" widget.
remove_meta_box('wp-statistics-referring-widget', 'dashboard', 'normal');
//Remove the "Daily Traffic Trend" widget.
remove_meta_box('wp-statistics-hits-widget', 'dashboard', 'normal');
//Remove the "Referrals from Search Engines" widget.
remove_meta_box('wp-statistics-search-widget', 'dashboard', 'normal');
//Remove the "Most Visited Pages" widget.
remove_meta_box('wp-statistics-pages-widget', 'dashboard', 'normal');
//Remove the "Most Active Visitors" widget.
remove_meta_box('wp-statistics-top-visitors-widget', 'dashboard', 'normal');
//Remove the "Latest Visitor Breakdown" widget.
remove_meta_box('wp-statistics-recent-widget', 'dashboard', 'normal');
//Remove the "Global Visitor Distribution" widget.
remove_meta_box('wp-statistics-hitsmap-widget', 'dashboard', 'normal');
//Remove the "Currently Online" widget.
remove_meta_box('wp-statistics-useronline-widget', 'dashboard', 'normal');
}
add_action('wp_dashboard_setup', 'plt_hide_wp_statistics_dashboard_widgets', 20);