Archived topic
Warning: Use of undefined constant REQUEST_URI
3 replies · Started by Nasif on January 9, 2019
Hi,
I am getting this error in my website:
Warning: Use of undefined constant REQUEST_URI - assumed 'REQUEST_URI' (this will throw an Error in a future version of PHP) in /home/xx/xx/wp-content/themes/generatepress/functions.php on line 73
Let me know how I can fix this.
Thanks
Hi there,
Weird. Also see lots of console errors as well:
https://www.screencast.com/t/Xnmcjb8kb48D
Can you try #1 here to eliminate any plugin conflicts first?
https://docs.generatepress.com/article/debugging-tips/
Let me know :)
It is probably too late to answer but I just had the exact problem and solved quickly. Just in case if anyone is looking for the solution this is how I handled:
$path = $_SERVER['HTTP_HOST'] . $_SERVER[REQUEST_URI];
changed to;
$path = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
Basically my functions.php line 73 was missing apostrophe (or whatever it is) on REQUEST_URI part. Don't know what caused it but this is how I solved. Cheers!
Just a heads up that that code shouldn't exist in functions.php: https://github.com/tomusborne/generatepress/blob/2.4.1/functions.php
If it's from a custom function you've added, you should use one of these methods instead: https://docs.generatepress.com/article/adding-php/