Archived topic
Getting a PHP error for theme
7 replies · Started by NIck on April 28, 2020
I am getting this in my theme
Warning Use of undefined constant HTTP_USER_AGENT - assumed 'HTTP_USER_AGENT' (this will throw an Error in a future version of PHP)
1 + wp-content/themes/generatepress_child/header.php:1
Core
Hi there,
The error is pointing to the header.php file in the child theme folder which shouldn't be there by default.
Did you actually need to modify that file?
Hello,
What would I be modifying?
You don't need the header.php file in your child theme folder at all if you aren't modifying it
Ok, I am not getting this error on my local site
By default, the child theme folder should only consists two files: function.php and style.css.
Anything else in there is extra unless you are modifying them.
You can download a fresh child theme if you'd like:
https://docs.generatepress.com/article/using-child-theme/#installing-a-child-theme
OK, reason I have this is for extra header code...
I found BOT code which I have deleted and fixed the error.
Not sure how as I use word fence.
Not sure what's the code you are adding but you could also consider using the wp_head hook with a hook element:
https://docs.generatepress.com/article/hooks-element-overview/