Cross-Origin Resource Sharing policy Error

This type of error common while cross sharing the resources/file with other domain or subdomain. Even calling resources from a non-WWW domain of the same site might cause this error. Here we will discuss the solution associated with WordPress CMS. Following is the general message shown in Inspect element console.

Font from origin 'http://example.com' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.example.com' is therefore not allowed access.

Solution on Cross-Origin Resource Sharing policy Error

  1. Login to WordPress admin panel
  2. Settings > General
  3. Verify WordPress address & Site Address (URL)
  4. Especially existence of WWW as per your needCross Origin Resource

For an accurate functioning of WordPress site, you need to apply the same strategy for both URLs. One with-WWW and second with non-WWW will push you into a trap of errors. This solution is applicable for same domain/TLD based WordPress site.