Skip to content

CORS: Access Control Allow Origin via PHP

Alex Zappa edited this page Jul 8, 2019 · 1 revision

For solve CORS policy on your WordPress with Elementor You can add the code to start of wp-config.php file. (code below)

$http_origin = $_SERVER['HTTP_ORIGIN'];

if ($http_origin == "http://www.domain1.com" || $http_origin == "http://www.domain2.com" || $http_origin == "http://www.domain3.com")
{  
    header("Access-Control-Allow-Origin: $http_origin");
}

Note: replace domain names ;)

Clone this wiki locally