How can I prevent a function from loading in the admin screens?

When I add this code to my theme’s functions.php file, it crashes my admin panel. How can I prevent it from loading in the admin screens?