How to Fix Mixed Content Errors

Updated: 4 December 20264 min read53 viewsMarkdown

Your SSL certificate is installed and the site opens over HTTPS, yet the padlock still shows a warning. Almost always, something on the page is loaded over HTTP. This is called mixed content. This guide shows how to find the offending resources and fix them for good.

A web page made of secure blocks with a single dashed image block marked with a warning sign
One HTTP resource is enough to stop a whole page from looking secure.

What is mixed content?

If the page itself loads over HTTPS but one of its resources (an image, script, stylesheet or font) is requested from an http:// address, the browser no longer treats the page as fully secure. There are two kinds:

  • Passive mixed content: images, video and audio. Current browsers usually try to upgrade these to HTTPS automatically and skip them if that fails.
  • Active mixed content: scripts (JavaScript), stylesheets and iframes. Browsers block these outright, so the page may look broken or some features may stop working.

Before you start

  • Your site needs a valid SSL certificate and an HTTP-to-HTTPS redirect. See "How to remove the Not secure warning".
  • Back up first if you are going to make bulk changes to the database.

Step 1: Find the offending resources

  1. Open the affected page in Chrome, Edge or Firefox.
  2. Press F12 to open the developer tools and switch to the Console tab.
  3. Reload the page. Warnings starting with "Mixed Content" show the full address of every resource requested over HTTP.
  4. Note the addresses; often the same resource (a theme image or an old plugin) repeats across many pages.
Three-step flow: a console with a highlighted warning line, an open-padlock link changed to a closed-padlock one, and a secure address bar
1: find the warnings in the console, 2: change HTTP links to HTTPS, 3: check the padlock.

On WordPress

  1. Under Settings > General, make sure WordPress Address (URL) and Site Address (URL) start with https://.
  2. Replace the old addresses inside posts and pages in bulk. If WP-CLI is available on your server, this does the job:
wp search-replace 'http://example.com' 'https://example.com' --skip-columns=guid --dry-run
wp search-replace 'http://example.com' 'https://example.com' --skip-columns=guid

The first command (--dry-run) changes nothing and shows how many entries would be affected; if the result looks right, run the second. Without WP-CLI, a reputable "search and replace" plugin does the same.

  1. If the problem remains, search your theme and plugin files for hard-coded http:// addresses; update them or report them to the developer.
  2. If you use a cache plugin such as LiteSpeed Cache, purge the cache when you are done.

On other sites

Change resource addresses starting with http:// to https:// in your HTML, templates and CSS. For resources on your own domain, relative paths (/images/logo.png) are a good option too. If an external resource does not support HTTPS, host the file yourself or use an alternative.

Stopgap: tell browsers to upgrade requests

Until every link is fixed, you can add this line to .htaccess so browsers automatically request HTTP resources over HTTPS:

Header always set Content-Security-Policy "upgrade-insecure-requests"
Note

This header only rescues resources that support HTTPS. An external resource without HTTPS still fails to load; fixing the links is the permanent solution.

Step 3: Check the result

Clear the cache and reopen the page in a private window. If no "Mixed Content" warnings remain in the console and the padlock is closed, you are done. Check other pages too, especially checkout and contact forms.

Troubleshooting

SymptomLikely causeFix
Warning on some pages onlyOld image links in that page's contentEdit the post or run a bulk replace.
Fixed, but the warning persistsPage cache or CDN cachePurge the plugin and CDN caches.
Menu or slider looks brokenBlocked active content (script or style)Fix HTTP addresses in theme and plugin files.
An external widget does not loadThe external service does not support HTTPSUse the service's HTTPS embed code or switch provider.

Frequently asked questions

Does mixed content put my site at risk?

A script loaded over HTTP can be altered in transit, so active mixed content is a real security risk. Passive content is less risky but still costs visitor trust.

Can a plugin fix it in one click?

Some plugins rewrite addresses on every page load. It is a quick fix, but adds work on every visit. The permanent, faster fix is to correct the addresses in the database once.

What should I watch out for with search-replace?

Back up first, run it in dry-run mode and leave the guid column alone.

If you cannot solve it, contact us or open a support ticket from the client area. Looking for infrastructure tuned for WordPress? See our WordPress hosting plans.

Was this article helpful?
Thank you for your feedback.