How to Hide the "Generate Security.txt" Admin Menu

function plt_hide_generate_security_txt_menus() {
	//Hide the "Tools → Generate Security.txt" menu.
	remove_submenu_page('tools.php', 'security_txt_generator');
}

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

Where do I put this code?