How to Hide Image Optimizer - Compress, Resize and Optimize Images Admin Menus

function plt_hide_image_optimization_menus() {
	//Hide the "Tools → Scheduled Actions" menu.
	remove_submenu_page('tools.php', 'action-scheduler');

	//Hide the "Media → Image Optimizer" menu.
	remove_submenu_page('upload.php', 'image-optimization-settings');
	//Hide the "Media → Bulk Optimization" menu.
	remove_submenu_page('upload.php', 'image-optimization-bulk-optimization');
}

add_action('admin_menu', 'plt_hide_image_optimization_menus', 11);

Where do I put this code?