Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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:


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.

share|improve this question

2 Answers 2

up vote 4 down vote accepted

To add to what Milo said, here are 2 great posts on the subject.

Also for the sake of learning, the first slideshow http://andrewnacin.com/2011/04/16/wordcamp-seattle/

share|improve this answer
He wast ask what not to do, question was simple-how get wp-load.php address. –  Tommixoft Sep 30 '14 at 14:09

Don't. Use AJAX the proper WordPress way.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.