Archived topic
How to ensure that code won't be overwritten?
1 reply · Started by Petar on October 23, 2022
I am using a child theme. But my google analytic code and line of code that is used to serve banners on my site, are placed inside header.php of the main theme between <head> and </head>.
How to ensure they won't be overwritten in the future with theme updates? Because I've just discovered this happened
Hi there,
You would need to move that code to the child theme or add it with a hook element:
https://docs.generatepress.com/article/hooks-element-overview/
Let me know if this helps :)