Yes, of course. I put that code in the child theme’s functions.php. Glad to know it’s a good solution and I hope it helps someone else.