I've written a PHP file that I use as a template for a WordPress page and I want to refer to some WordPress functions on the page so at the top I have:
require_once("/nas/wp/www/bb2/wp-blog-header.php");
global $wpdb;
"/nas/wp/www/bb2/" is the root of my site and I can clearly see that wp-blog-header.php is there in the root:
![Site root]()
Yet, when the PHP file runs it throws the error:
Warning: require_once(/nas/wp/www/b
b2/wp-blog
-header.ph
p): failed to open stream: No such file or directory . . .
Why doesn't it see wp-blog-header.php?
I have a staging copy of the site (the site is hosted on WP Engine, where it's easy to create staging sites) and it works there! The only difference is that I included "staging" in the path to wp-blog-header.php:
require_once("/nas/wp/www/staging/bb2/wp-blog-header.php");
global $wpdb;
Does anyone have any idea what could be going on? After half a day looking at this, I'm out of ideas.
Thanks
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.