Where to put add_action() in WordPress

Solution:

“functions.php” is the file where you want to put your custom functions, hooks and actions. If your theme doesn’t have a functions.php just create it. WordPress will get the contents of it automatically, so you will have access to defined functions anywhere in your theme.