You need to add the custom action function in a code snippet or in functions.php file.
Also, have a look here