Cannot load admin-ajax.php. No access-control allow origin*
I cannot load admin-ajax.php
and I keep getting this error message:
XMLHttpRequest cannot load ..../wp-admin/admin-ajax.php.,. No 'Access-Control-Allow-Origin' header is present on...
On local WAMP it worked just to add this:
header("Access-Control-Allow-Origin: *");
(Even if this seems very stupid because next time WordPress updates I guess this would disappear.)
When I upload this to my production server it's still the same message:
XMLHttpRequest cannot load ..../wp-admin/admin-ajax.php.,. No 'Access-Control-Allow-Origin' header is present on...
I've tried to modify the .htaccess
file and that seemed to activate CORS, but that won't affect admin-ajax.php
:
IfModule mod_headers.c
Header add Access-Control-Allow-Origin: *
/IfModule
I've also tried to install WP-CORS plugin without success.