You installed the certificate, flipped the site to HTTPS, and the browser still refuses to show the padlock. Or worse — the padlock shows on the home page, but your checkout page loads unstyled and the slider on the front page does nothing. The culprit is almost always WordPress mixed content: your page loads over HTTPS, but at least one image, script, stylesheet, or font still comes over plain HTTP. This guide shows you how to find every insecure URL, fix it at the source, and prove the padlock is back — with WP-CLI, with a plugin, and with the two traps (reverse proxies and Cloudflare Flexible mode) that keep the warning coming back.
All facts verified against MDN, the official WP-CLI command reference, and the WordPress.org plugin directory on 19 November 2026.
What WordPress mixed content actually is
Mixed content is a secure page that fetches some of its resources over an insecure connection. The page itself arrives encrypted, but an image, script, or stylesheet loaded over HTTP can be read — or changed — by anyone sitting between your visitor and your server. That is why browsers treat it as a security problem, not a cosmetic one.
Browsers split mixed content into two groups, and the split decides what your visitors actually see:
| Type | What it covers | What the browser does | What you notice |
|---|---|---|---|
| Upgradable | Images, audio, video (plain src, CSS background images) |
Silently rewrites http:// to https:// and retries |
Nothing — until the HTTPS version does not exist, and then the image just vanishes |
| Blockable | Scripts, stylesheets, iframes, web fonts, fetch() and XMLHttpRequest calls, images in srcset or <picture> |
Refuses the request outright | Broken layout, dead sliders, missing fonts, forms that do nothing |
That table explains the two classic symptoms. If only images are affected, the page looks fine and the padlock quietly disappears — the browser upgraded the images and nobody told you. If a script or stylesheet is affected, the page visibly breaks, because the browser blocked it. And there is one nasty edge case MDN documents: an image whose host is an IP address instead of a domain name is blocked, not upgraded — so http://93.184.215.14/image.png fails even though the same image on a domain would load.
The important consequence for WordPress: the warning is about individual requests, not your certificate. A perfectly valid certificate and an HTTPS address do not repair old HTTP references buried in your database, theme, or plugin settings. You have to find them and fix them at the source.
Step 1: Find the exact insecure URLs
Never start fixing before you know what is broken. Guessing wastes an afternoon; the browser tells you exactly which URLs are insecure.
Use the browser console
Open the affected page over HTTPS, press F12, and click the Console tab. Every mixed content warning names the exact http:// URL. Reload the page and read the list. Do this on more than one page type — the home page, a post, a page with embeds, and the checkout or contact page — because different templates load different assets.
Scan a page from the outside
For a second opinion, paste the URL into a free scanner such as WhyNoPadlock. It fetches the page and lists every insecure resource with the exact URL, which is handy when you want to show a client or a host what is wrong. Remember it only scans the page you give it, not the whole site — scan a few page types, not just the home page.
Grepping your own HTML
If you have SSH access, you can see every insecure reference in a page in one command:
curl -fsS https://example.com/ | grep -oE '(src|href)="http://[^"]*"'
That catches anything in the delivered HTML. It will not catch resources loaded later by JavaScript — for those, the console is the authority.
Step 2: Set both WordPress addresses to HTTPS
The most common single cause is also the easiest to miss. WordPress stores two addresses — WordPress Address (URL) and Site Address (URL) — and if either still says http://, WordPress keeps generating insecure links for menus, images, scripts, and stylesheets on every page.
Go to Settings > General and change both fields so they start with https://. If the fields are greyed out, they are locked in wp-config.php — edit the constants there instead:
define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );
Clear every cache after this change — your caching plugin, your host’s server cache, and Cloudflare if you use it — then reload the page and check the console again. On many sites this single step clears the warning entirely, because the URLs in the database were never the problem; only the generated ones were.
Step 3: Replace the old HTTP URLs in the database (the real fix)
If the console still lists insecure URLs after Step 2, they are baked into your content: old posts, widgets, theme options, and plugin settings that store full URLs. Changing the site address does not touch them. You need a search and replace across the database — and one that understands serialised data. WordPress stores many settings as serialised PHP, where each string is prefixed with its length; a plain SQL REPLACE() changes the URL without updating the length, which corrupts the value. Both methods below handle serialisation correctly.
Method A: WP-CLI (the reliable way)
If you have SSH access, wp search-replace is the safest option. It decodes serialised values, replaces the URL, and re-encodes them with correct lengths. Always back up first, then dry-run:
wp db export before-https-fix.sql
wp search-replace 'http://example.com' 'https://example.com' --skip-columns=guid --dry-run --report-changed-only
Read the dry-run report — it tells you exactly which tables and how many fields would change. Two flags matter. --skip-columns=guid leaves the guid column alone: the guid is meant to be a permanent identifier for a post, not a live URL, and changing it can break feed readers. --dry-run previews the work without touching anything. When the report looks right, run the same command without --dry-run:
wp search-replace 'http://example.com' 'https://example.com' --skip-columns=guid --report-changed-only
On a multisite install, add --network so every site’s tables are included. And if your site sits behind a proxy or CDN, check the result with wp option get siteurl afterwards — the command rewrites the database, but a proxy can still make WordPress generate HTTP URLs at runtime (see Step 5).
Method B: Better Search Replace (the dashboard way)
Without SSH access, install Better Search Replace from the WordPress.org plugin directory (version 1.4.11, updated June 2026, 4.3 out of 5 from 546 reviews). It is serialisation-aware, lets you select specific tables, and has the same dry-run preview — run the dry run first, read the field counts, and only then uncheck it and run the replacement. The plugin’s own listing warns you, correctly, that a wrong search string can damage the database: back up before you touch anything, and double-check that the search string is your own domain, not a bare http:// that would also rewrite third-party URLs you never intended to touch.
After either method, purge every cache and re-check the console. If the warnings are gone on the pages you tested, the database fix is done. Do not delete the backup yet — keep it until you have clicked through the site the next day.
Step 4: The five-minute plugin fix (and its limit)
If you need the warning gone right now — a client is looking at the site, or the checkout is broken — SSL Insecure Content Fixer is the quickest patch. It is free on WordPress.org (version 2.7.2, updated 6 September 2026, 100,000+ active installs, 4.8 out of 5 from 221 reviews). Install it, activate it, and it rewrites insecure URLs to HTTPS on the fly as each page is served. If the warning persists, raise its fix level in the plugin settings — the higher levels rewrite more aggressively, including content WordPress generates itself.
Understand what this does and does not do. It masks the problem: the database still contains http:// URLs, and every page pays a small rewriting cost on every request. It is a bandage, not a cure. Use it to stop the bleeding today, then do the database replacement in Step 3 and remove the plugin — or keep it only if a plugin you cannot replace keeps emitting HTTP URLs. Test the database fix with this plugin deactivated, or you will never know whether the database fix actually worked.
Step 5: The proxy trap — when WordPress cannot see HTTPS at all
Here is the case that eats entire afternoons. Your certificate is valid, both WordPress addresses say https://, the database is clean — and the warning is still there. The cause is usually in front of WordPress, not inside it.
WordPress decides whether a request is secure by checking $_SERVER['HTTPS']. If a proxy or CDN terminates TLS and talks to your origin over plain HTTP, that variable is empty and WordPress generates HTTP asset URLs on an HTTPS page. Tell WordPress about the original scheme by adding this near the top of wp-config.php, above the “stop editing” comment:
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO'] ) {
$_SERVER['HTTPS'] = 'on';
}
Only add this when a proxy really does terminate TLS for you, and only when the origin cannot be reached except through that proxy — the header is trivial to forge, so on a directly reachable server it lets anyone claim to be on HTTPS. Your proxy must also forward the header: in Nginx that is proxy_set_header X-Forwarded-Proto $scheme;, and in Apache, RequestHeader set X-Forwarded-Proto "https".
Cloudflare Flexible mode is the same trap, dressed up
If you use Cloudflare, check your SSL mode under SSL/TLS > Overview. In Flexible mode, Cloudflare encrypts the visitor-to-Cloudflare leg and talks to your origin over plain HTTP. That produces exactly two symptoms: mixed content warnings, because WordPress builds URLs from the HTTP scheme it sees; and the dreaded ERR_TOO_MANY_REDIRECTS loop, because your origin redirects HTTP to HTTPS, Cloudflare requests the page over HTTP again, and the two sides hand the request back and forth until the browser gives up after about twenty hops.
The fix is not to remove your redirect. It is to stop using Flexible: put a valid certificate on your origin (your host’s free AutoSSL or Let’s Encrypt certificate is enough) and switch the mode to Full (strict), which encrypts both legs and validates the origin certificate. Then purge the Cloudflare cache — a cached redirect keeps looping long after the setting is correct. Flexible exists for origins that genuinely cannot do TLS; if yours can, never use it.
Step 6: Hard-coded URLs in themes, plugins, and embeds
Some insecure URLs do not live in the database at all. Grep your theme and plugin files for hard-coded http:// references:
grep -r "http://" wp-content/themes/your-theme/ wp-content/plugins/ --include="*.php" | grep -v "http://www.w3.org" | grep -v "http://schema.org"
The two exclusions matter: XML namespaces and schema.org URLs are identifiers, not requests, and changing them breaks nothing but fixes nothing either. For real hits — a font loaded from an old CDN, a script enqueued with a hard-coded scheme — edit the file in a child theme (never the parent theme, or the next update wipes your fix), or replace the enqueue with a protocol-relative or HTTPS URL.
Third-party embeds need the same treatment, one by one. Open each insecure URL the console reported and try the https:// version in a new tab. If it loads, update the embed to the HTTPS URL. If it does not — the provider has no certificate, or the resource no longer exists — you have three honest options: self-host the file, find an HTTPS equivalent, or remove the embed. There is no fourth option that keeps both the embed and the padlock.
Widgets deserve a special mention: text widgets, custom HTML widgets, and page-builder sections (Elementor, Divi, and similar) store their own content, and a database search-replace usually catches them — but builders that store data as JSON or in their own tables sometimes escape it. If a single page still warns after the database pass, open that page’s builder and search its sections by hand.
Step 7: The safety net — upgrade-insecure-requests (temporary only)
While you work through the fixes above, a Content Security Policy header can hide the warning from visitors:
# Apache (.htaccess) or Nginx (server block)
Header set Content-Security-Policy "upgrade-insecure-requests;"
# Nginx
add_header Content-Security-Policy "upgrade-insecure-requests;" always;
This tells the browser to rewrite every insecure request to HTTPS before sending it — including the blockable kinds it would otherwise refuse. It is a useful safety net during a migration, and a reasonable permanent header on a healthy site. But it is not a fix: if a resource has no HTTPS version, the upgrade fails and the resource still does not load, and you have now hidden the console warnings that would have told you. Add it, finish the real fixes, then decide whether to keep it. If your site already has a CSP, add the directive to the existing header instead of sending a second one.
When the fix creates a redirect loop
The most common self-inflicted wound in this whole job is ERR_TOO_MANY_REDIRECTS appearing right after you “fixed” HTTPS. It means two rules are redirecting the visitor back and forth, and the usual pair is a plugin or WordPress setting forcing HTTPS while a proxy or host panel also forces it — or Cloudflare Flexible mode, covered in Step 5.
The rule is simple: exactly one HTTP-to-HTTPS redirect, in one place. Audit yours. Check wp-config.php for WP_HOME/WP_SITEURL, check .htaccess or the Nginx server block, check your security or SSL plugin’s force-HTTPS setting, and check your host panel and Cloudflare’s “Always Use HTTPS”. Disable all but one, purge every cache, and test in a private window. If wp-admin is locked out by the loop, set the two URLs in wp-config.php — that overrides the database values and usually gets you back in.
Verify the fix and keep it fixed
Run this checklist before you call the job done:
- Console clean: reload the home page, a post, a page with embeds, and the checkout or contact page with DevTools open. Zero mixed content warnings on all four.
- External scan clean: run WhyNoPadlock on the home page and one post. Both clean.
- HTTP redirects once:
curl -I http://example.com/should return a single 301 to the HTTPS address, not a chain. - Padlock on every page type: click through the site as a visitor, including the login page and any page with a form.
- Caches purged: plugin cache, server cache, and CDN cache — a stale cached page can show the old warning for hours after the fix.
To stop the warning coming back, make two habits. First, never paste an http:// URL into a post, widget, or theme file again — if a resource has no HTTPS version, do not use it. Second, re-check after every migration, staging push, or plugin install: a staging database copied to production with the old URLs is the single most common way this warning returns, and a five-second console check after each deploy catches it before your visitors do.
WordPress mixed content looks like a certificate problem, but it almost never is. The certificate did its job the moment it was installed. The warning is a trail of old HTTP addresses your site is still carrying — in the database, in a theme file, or in the gap between your proxy and WordPress. Follow the trail in order, fix each address at its source, and the padlock comes back and stays back.
Further Reading & References
- Mixed content — MDN Web Docs — the authoritative definition: upgradable vs blockable content, what browsers upgrade, block, and warn about.
- wp search-replace — WP-CLI Command (WordPress Developer Resources) — the official reference: serialised-data handling,
--dry-run,--skip-columns=guid, and the--networkflag for multisite. - WP-CLI — Make WordPress Hosting Handbook — the hosting team’s guidance: back up before
search-replace, dry-run first, and never change theguidcolumn on an existing site. - SSL Insecure Content Fixer — WordPress.org — the free plugin used in Step 4: version 2.7.2, updated 6 September 2026, 100,000+ active installs.
- Better Search Replace — WordPress.org — the serialisation-safe dashboard plugin used in Step 3: version 1.4.11, dry-run preview, multisite support.
- How to Quickly Fix Mixed Content Warnings (HTTPS/SSL) — Kinsta — a clear four-step walkthrough, including the WhyNoPadlock scanner and the JitBit SSL Check crawler.
- 7 Steps to Fix Mixed Content Errors — Hostdango — console-first diagnosis, the database search-replace, and the re-scan-to-confirm step.
- Cloudflare Flexible SSL: What It Actually Encrypts, the Redirect Loop It Causes, and How to Move to Full (Strict) — RunxBuild — the Flexible-mode mechanism, the redirect loop step by step, and the move to Full (strict).



