Tips on Customizing MonsterInsights – Google Analytics Dashboard for WordPress (Website Stats Made Easy)

How to Hide Google Analytics for WordPress by MonsterInsights Admin Menus

function plt_hide_google_analytics_for_wordpress_menus() {
	//Hide "Dashboard → Insights".
	remove_submenu_page('index.php', 'admin.php?page=monsterinsights_reports');

	//Hide "Insights".
	remove_menu_page('monsterinsights_reports');
	//Hide "Insights → Setup Checklist15".
	remove_submenu_page('monsterinsights_reports', 'monsterinsights_settings#/setup-checklist');
	//Hide "Insights → Reports".
	remove_submenu_page('monsterinsights_reports', 'monsterinsights_reports');
	//Hide "Insights → Settings".
	remove_submenu_page('monsterinsights_reports', 'monsterinsights_settings');
	//Hide "Insights → Site Notes".
	remove_submenu_page('monsterinsights_reports', 'http://127.0.0.1/wp-admin/admin.php?page=monsterinsights_settings#/site-notes');
	//Hide "Insights → AI Insights".
	remove_submenu_page('monsterinsights_reports', 'admin.php?page=monsterinsights_reports#/ai-insights');
	//Hide "Insights → Conversations AI".
	remove_submenu_page('monsterinsights_reports', 'admin.php?page=monsterinsights_reports#/ai-insights/chat');
	//Hide "Insights → Popular Posts".
	remove_submenu_page('monsterinsights_reports', 'http://127.0.0.1/wp-admin/admin.php?page=monsterinsights_settings#/popular-posts');
	//Hide "Insights → User Journey".
	remove_submenu_page('monsterinsights_reports', 'admin.php?page=monsterinsights_reports#/user-journey-report');
	//Hide "Insights → SEO".
	remove_submenu_page('monsterinsights_reports', 'http://127.0.0.1/wp-admin/admin.php?page=monsterinsights_settings#/seo');
	//Hide "Insights → Tools".
	remove_submenu_page('monsterinsights_reports', 'http://127.0.0.1/wp-admin/admin.php?page=monsterinsights_settings#/tools');
	//Hide "Insights → Addons".
	remove_submenu_page('monsterinsights_reports', 'http://127.0.0.1/wp-admin/admin.php?page=monsterinsights_settings#/addons');
	//Hide "Insights → UserFeedbackNEW".
	remove_submenu_page('monsterinsights_reports', 'http://127.0.0.1/wp-admin/admin.php?page=monsterinsights_settings#/userfeedback');
	//Hide "Insights → About Us".
	remove_submenu_page('monsterinsights_reports', 'http://127.0.0.1/wp-admin/admin.php?page=monsterinsights_settings#/about');
	//Hide "Insights → Growth Tools".
	remove_submenu_page('monsterinsights_reports', 'http://127.0.0.1/wp-admin/admin.php?page=monsterinsights_settings#/growth-tools');
	//Hide "Insights → Upgrade to Pro".
	remove_submenu_page('monsterinsights_reports', 'https://www.monsterinsights.com/lite/?utm_source=liteplugin&utm_medium=admin-menu&utm_campaign=submenu&utm_content=9.2.2');
}

add_action('admin_menu', 'plt_hide_google_analytics_for_wordpress_menus', 12);

Where do I put this code?

How to Hide the "MonsterInsights" Dashboard Widget

function plt_hide_google_analytics_for_wordpress_dashboard_widgets() {
	$screen = get_current_screen();
	if ( !$screen ) {
		return;
	}

	//Remove the "MonsterInsights" widget.
	remove_meta_box('monsterinsights_reports_widget', 'dashboard', 'normal');
}

add_action('wp_dashboard_setup', 'plt_hide_google_analytics_for_wordpress_dashboard_widgets', 20);