Fix mixed content in PHP files

When you see a ‘PHP file with mixed content’ mixed content file in your mixed content scan, the result cannot be fixed automatically. The scan does provide all the information required to fix the file manually. When seeing such a result in your scan overview, it will provide you with the location of the file. This is outlined in red in the example below.

The location will tell you exactly which file the mixed content is coming from. In this case, the mixed content is coming from the footer.php file in the Twenty Twenty theme folder. Now we know where the mixed content is coming from, but what causes it and how can we fix it?

To get more information about the result, press the ‘Details’ button on the right side of the page.

The detailed information contains a Blocked URL, this is the URL that cannot load over https:// and thus results in a mixed content warning.

Since we cannot fix the file automatically, you can press the ‘Edit’ button in the bottom right corner of the details popup. Pressing this button will take you to the file editor. In the file editor, we can then search for the Blocked URL:

To fix the issue, you can now add the image to your own media library (if you have permission from the image owner), and replace the image URL with the one on your own domain. Alternatively, you can remove the image entirely.

Any questions? Let us know and we’ll be happy to help!

Lightweight plugin, Heavyweight Security features. Get Pro and leverage your SSL certificate for WordPress security standards.