I can’t add featured image in WordPress

Problem: We can’t add featured image to page or post in WordPress, also we can’t add image or file in fields of Advanced Custom Fields plugin.

It is impossible add featured image in WordPress

Solution: Firstly, should look to browser console. If you can see some like this:

Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "default-src 'self' 'unsafe-inline' data ...

you're on the right track and this solution for you :) This issue arises because of wrong configured Content Security Policy (CSP). To check fact, that CSP enable on your site we can use next service, that check headers. Sure, we can check headers in the browser console too.

Next, we looking for place where the settings was set:

  1. .htacces file
  2. Some plugins e.g Content-Security-Policy may has settings or code for headers change. Also, you can look in files of theme (e.g. header.php, index.php, etc)
  3. Hosting provider use CSP settings (it is unlikely way)
Leave Comment

Your email address will not be published. Required fields are marked *