Issue with ABSPATH already defined
|Reported by:||ontic||Owned by:|
A recent project of mine involved using Ajax and I noticed a problem when trying to include a couple of files.
I was acquiring the location of ABSPATH manually because the file I was working with had no involvement with any Wordpress files. Below is an example of how I was calculating the correct location.
"$path = rtrim(dirname(dirname(dirname(FILE))), '/').'/';"
So this enabled me to "require_once" the "admin.php" file. It was not necessary to include the "wp-load.php" file because "admin.php" does that itself.
Inside the file "admin.php" it includes the "wp-load.php" file like so.
if ( defined('ABSPATH') )
require_once(ABSPATH . 'wp-load.php');
In my case "wp-load.php" cannot be included because it has no idea of its location. When I tried defining ABSPATH myself, I then encounter another problem. Which can be overcome, by checking whether ABSPATH has already been defined in the file "wp-load.php" please see the attached patch.