Hi Ben,
Thanks for the reply and the effort you’ve gone to trying to replicate.
The site is actually an imported site which I created for students to work on. It has the Twenty Sixteen parent theme installed and I have students create a child theme using a plugin. I have tried adding the code to the website when it is still using the parent theme, before creating and activating the child, but again I get the same error.
I’m on a standalone computer, not on a company network. It was working earlier in the year and for the years prior that i’ve used this as my training demo site but last 4-6 weeks has stopped working. It is also happening on all student computers so it’s either localwp or site specific. I know it’s not the code because I’ve tested the code on my live websites and it works, and the functionality works if I edit functions.php locally rather than via the Dashboard interface but it defeats the purpose as I’m teaching WordPress specifically.