I have a plugin which calls a stand-alone php script (myAjax.php) via a jQuery.ajax() script inside the plugin.
I need to place the following code into the myAjax.php file:
require_once('../../../wp-load.php');
if (!is_user_logged_in()){
die("You Must Be Logged In to Access This");
}
if( ! current_user_can('edit_files')) {
die("Sorry you are not authorized to access this file");
}
However, I'd like a more bulletproof method of specifying the path to wp-load.php in case the actual relative path is different than my example.