Font Awesome And “Access-Control-Allow-Origin” Fix

By April 1, 2019 Web Development development

Sometimes cross domain scripting access is a pain in the butt and necessary in WordPress. Especially when dealing with Font Awesome (or web fonts in general) and third party data aggregation sites.. like say IDX or something. Here are my fixes. This post is for no other reason than I need to write this down somewhere to remember this.

Include in .htaccess

<IfModule mod_headers.c>
  <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$">
    Header set Access-Control-Allow-Origin "*"

Include in functions.php

function add_cors_http_header(){
    header("Access-Control-Allow-Origin: *");