So, I have a custom php file in my wordpress root folder.
I have a link in frontend "example.com/custom.php"
that I would like to access.
How would I include this custom php in root folder in function.php so that it can be recognized by other wordpress function?
Thanks
Add this line in your themes functions.php:
Explanation:
Your wp-config.php should contain the following code (near the bottom of the page):
They are saving the path to the wordpress installation to ABSPATH.
It will be something like “/var/www/foo/” or similar. So you can concat the ABSPATH with path to your file. If for example, your php file is located inside some folder like this “example.com/somefolder/custom.php” you would use
Hope this helps!