access-control-allow-origin php wordpress code example
Example 1: php Access-Control-Allow-Origin
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
Example 2: wordpress Access-Control-Allow-Origin
function add_cors_http_header(){
header("Access-Control-Allow-Origin: *");
}
add_action('init','add_cors_http_header');