WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a user using my plugin with the following wp setup

WordPress Address (URL)

Site Address (URL)

I am using admin_url( 'admin-ajax.php' ) to pull the ajax url, which returns


When doing ajax requests from a page on http://www.somewebsite.com, it looks like the "same origin policy" is in effect and the requests fail. Any suggestions on how to fix this issue?

share|improve this question
So there is no wordpress on the domain http://somewebsite.com ? Do a server to server request to avoid same origin policy. – Sisir Mar 19 '12 at 16:57
up vote 3 down vote accepted

Depending on how you're mapping somewebsite.com, you can probably just define ajaxurl differently:

var ajaxurl = 'http://www.somewebsite.com/admin-ajax.php';

If you need something more generalizable, you could filter admin_url, sniff out whether it's asking for admin-ajax.php, and if so, then rewrite it using home_url() or something like that.

Getting cross-domain ajax to work is possible (with a proxy approach, for instance) but it's best to avoid it if at all possible.

share|improve this answer
Thanks. I will implement your suggestion. – pistolshrimp Mar 19 '12 at 17:49

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.