Where do I add an action hook & callback in my theme?

The best place for you is probably going to be in your Theme’s functions.php file. Navigate to /wp-content/themes/your-theme-name/functions.php. Paste it above/below any of the other code there, making sure to stay between any < ?php or ?> tags.

error code: 523