How to Fix Mixed Content Errors in WordPress

Picture of Ivan Predojev
Ivan Predojev

Writer

Table of Contents

To fix mixed content errors in WordPress, you change every http:// link your HTTPS pages still load, in 3 places: the site address settings, the database, and any theme, plugin or CDN setting that hardcodes old URLs. A plugin can patch the output on the fly, but a proper search and replace fixes the cause.

You install an SSL certificate and expect a padlock. Instead you get “Not secure”, a padlock with a warning triangle, or a page with no styles at all. Sounds familiar? That’s mixed content: an HTTPS page pulling in at least 1 file over plain HTTP. Below we’ll find every insecure URL, fix it at the source, deal with page builders and CDNs, and make sure the warning doesn’t come back next month.

What Mixed Content Actually Means

On an HTTPS page, the browser expects every image, script and stylesheet to arrive over HTTPS too. If even one file comes from an http:// address, the connection is no longer fully encrypted, and someone on the same café Wi-Fi could in theory swap that file for something else.

MDN’s guide to mixed content splits it into 2 groups. Upgradable content, meaning plain images plus audio and video, gets quietly rewritten to HTTPS by modern browsers, so if the HTTPS file exists, nobody notices anything. Everything else is blockable. The browser just refuses to load it.

Resource TypeBrowser BehaviorWhat You See
img with a plain srcUpgraded to HTTPSUsually nothing, if the HTTPS file exists
img with srcset or inside pictureBlockedMissing or broken images
audio and videoUpgraded to HTTPSUsually nothing
Scripts (script src)BlockedSliders, forms or menus stop working
Stylesheets (link href)BlockedPage loads with no styling
Web fontsBlockedFallback fonts, broken icons
iframesBlockedEmpty box where a map or video should be

That srcset row matters a lot on WordPress. Since version 4.4, WordPress has added responsive image markup with srcset to the images in your content, which means an old http:// image URL inside a post often isn’t upgraded at all. It just breaks. Images vanished right after the switch? This is the likely reason.

Why the Padlock Disappears After You Install SSL

A certificate only changes how the server answers. It doesn’t touch the thousands of stored URLs WordPress already saved, so every image you inserted and every setting a plugin saved still points at http://, because that’s what the site address was when they were created.

Here’s where the old URLs usually hide:

  • Site address settings: Settings > General still says http://.
  • Post and page content: Image tags, links and embeds saved in the wp_posts table. On a blog with 300 posts, this is by far the biggest pile.
  • Theme and plugin options: Logos and header backgrounds saved as full URLs in wp_options, often in serialized form, which matters later.
  • Page builder data: Elementor and Divi store their own copies of image URLs and generate CSS files that include them.
  • Hardcoded theme files: Someone typed http:// into header.php years ago.
  • Third-party resources: An old embed, a font service that never moved to HTTPS, or a tracking script pasted with an insecure address.
  • CDN or proxy settings: The CDN URL in a caching plugin still starts with http://, or a proxy talks to WordPress over HTTP so WordPress thinks the visitor does too.

Most sites have 2 or 3 of these at once. Fix only the first one and the warning keeps coming back on random pages.

How to Find Every Insecure URL

Make a list before you change anything. Open an affected page, press F12 and switch to the Console tab, where each blocked or upgraded file appears as a “Mixed Content” warning with its exact URL.

One page isn’t the whole site, though, so combine a few checks:

  • Browser console: Exact URLs per page.
  • View source: Press Ctrl+U and search for http://, starting with your own domain.
  • A site crawler: Screaming Frog’s free version crawls up to 500 URLs and can flag insecure resources across all of them in one run.
  • A database search: With shell access, WP-CLI can count how often the old address appears without changing a thing.
  • One page per template: Homepage, a post, a product page, the checkout. Templates differ.

Note where each bad URL lives. An image in a 2019 blog post and a script in your theme’s header are completely different jobs, and the list decides which fix you need.

Fix the Site Address Settings First

Start with the 2 settings WordPress uses to build every URL. In Settings > General, both the WordPress Address (URL) and the Site Address (URL) should start with https://. Greyed out? Then they’re defined in wp-config.php, and you change the WP_HOME and WP_SITEURL constants there instead.

define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );

Since version 5.7, WordPress can also make this switch from Tools > Site Health when it detects that HTTPS works on your server, and it rewrites old links to your own domain as pages are displayed. Handy. But the stored content still says http://, so treat it as a bandage.

Sites behind a reverse proxy or load balancer that handles SSL are a special case, because WordPress may see every request as plain HTTP and answer with either mixed content or an endless redirect loop. The WordPress guide to HTTPS for WordPress explains how to read the X-Forwarded-Proto header so WordPress knows the visitor is on HTTPS:

if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && strpos( $_SERVER['HTTP_X_FORWARDED_PROTO'], 'https' ) !== false ) {
    $_SERVER['HTTPS'] = 'on';
}

Put it above the “That’s all, stop editing!” line in wp-config.php.

Run a Safe Search and Replace

This is the step that actually fixes most mixed content: you replace http://example.com with https://example.com everywhere in the database. Back up files and database first. There’s no undo button, and a typo in the domain can break every link on the site in a second.

Don’t run a raw SQL REPLACE in phpMyAdmin. Plugins and themes store many settings as serialized data, where each string carries its own length, so turning “http” into “https” leaves the length off by 1 and PHP can no longer read the setting. Widgets disappear. Theme options reset. Tools built for WordPress, such as Better Search Replace or WP-CLI, rewrite those lengths for you.

With SSH access, the WP-CLI search-replace command is the cleanest option. Do a dry run first:

wp search-replace 'http://example.com' 'https://example.com' --all-tables --skip-columns=guid --dry-run

It prints how many replacements it would make per table. If the numbers look sane, run it again without –dry-run. Skipping the guid column is deliberate, since WordPress uses it as a permanent ID for feed readers and never loads anything from it.

  • Replace your exact domain: Use http://example.com, not just http://, or you’ll rewrite links to other sites that may not support HTTPS at all.
  • Cover www too: If the site ever ran on both, do a second pass for the www version.
  • Clear caches afterward: Every layer, including the CDN.

Better Search Replace does the same from the dashboard, with its own dry run checkbox. On a big WooCommerce database, WP-CLI is less likely to time out halfway.

Plugin vs Manual Fix: Which One to Use

Really Simple SSL and SSL Insecure Content Fixer are popular for a reason: activate one and the padlock is back within a minute. They work by rewriting the page output as it’s sent, swapping http:// for https:// on the way out, while your database stays exactly as it was.

Fine as a bridge. As a permanent setup it’s weaker than fixing the data, because every request does extra work, the fix vanishes if the plugin is ever deactivated, and the more aggressive modes of SSL Insecure Content Fixer can clash with AJAX features.

MethodHow It WorksBest ForDownsides
Rewriting pluginChanges URLs in the output on each requestQuick fix, no shell accessExtra work per request, fix disappears with the plugin
Better Search ReplaceUpdates URLs in the database onceMost sites, dashboard onlyCan time out on very large databases
WP-CLI search-replaceSame, from the command lineLarge sites, agencies, migrationsNeeds SSH access
Editing theme filesChanges hardcoded URLs at the sourceOld custom themesLost on theme update unless in a child theme
upgrade-insecure-requests headerBrowser upgrades every request itselfSafety net after the real fixFiles that don’t exist on HTTPS still fail

Our order is simple. Database first, leftover theme code by hand, the header last as a safety net. Need the padlock back in the next 10 minutes? Use a plugin today and do the database work this week.

Hardcoded URLs in Themes, Page Builders and CDNs

If the console still lists insecure files after the search and replace, they’re coming from somewhere the database doesn’t reach. Look at the path in the warning. When it points into a theme or plugin folder, search that code for http:// and change it, ideally in a child theme so the next update doesn’t put it back.

Page builders need their own step. Elementor keeps generated CSS files with full image URLs baked in, so old background images can survive a database fix. Use Elementor > Tools > Replace URL, then click Regenerate CSS & Data so the files get rebuilt.

CDNs and proxies cause the most confusing cases:

  • Cloudflare Flexible SSL: Visitors get HTTPS, but Cloudflare talks to your server over HTTP. WordPress then prints insecure links, or the site loops. Switch the SSL mode to Full (strict) once the server has its own certificate.
  • CDN field in a caching plugin: WP Rocket and W3 Total Cache both have one, and an old value there rewrites every image to an insecure address.
  • Dead CDN hostnames: Replace them with your own domain.

If a script or font comes from a service with no HTTPS version, you can’t fix it from your side, so replace it, host it yourself or remove it.

Force HTTPS With Redirects and Headers

Once the content is clean, make sure nobody can reach the HTTP version. On Apache, add a 301 redirect above the “BEGIN WordPress” block in .htaccess:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

On Nginx, it’s a return 301 in the server block listening on port 80. Our guide to WordPress redirects covers both servers in more detail, including how to avoid chains.

Then add the safety net. The upgrade-insecure-requests directive, documented on MDN’s upgrade-insecure-requests page, tells the browser to fetch every insecure resource on the page over HTTPS instead, and it’s a single header:

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

It won’t help if a file doesn’t exist on HTTPS. It catches the odd stray link in an old post, though, and that’s its job.

HSTS goes further and tells browsers to never try HTTP on your domain again, so add it only when every subdomain works on HTTPS, because browsers remember it for the full max-age (often 31536000 seconds, a whole year) and you can’t easily take it back.

Common Mistakes That Bring the Warning Back

Mixed content likes to return a few weeks later. It’s nearly always one of these.

MistakeWhat HappensFix
Raw SQL REPLACE on the databaseSerialized settings break, widgets vanishRestore the backup, redo it with a WordPress-aware tool
Replacing every http:// on the siteLinks to sites without HTTPS breakReplace only your own domain
Only using a rewriting pluginWarning returns when the plugin is offFix the database, keep the plugin as a bridge
Forgetting cachesOld HTML keeps loading for hoursPurge every cache layer
Cloudflare left on Flexible SSLRedirect loops or insecure linksSwitch to Full (strict)
Editing the parent themeNext theme update brings the old URL backMove the change into a child theme
Testing only the homepageCheckout or archive pages still warnTest one page of every template

Caching can hide a fix that already worked. Our article on WordPress caching shows where each layer sits.

Then test once more in a private window with the console open. No warnings there means you’re done.

How Webueno Handles Mixed Content Fixes

At Webueno, a mixed content ticket usually goes to our troubleshooting service, which covers server issues and fixes after updates. We take a full backup first and crawl the site for insecure resources. Then we run the search and replace with a dry run first, clean up hardcoded theme and builder URLs, check the CDN and proxy settings, and test each template type in a clean browser before closing the ticket.

On our WordPress hosting, each site runs on its own DigitalOcean VPS, one site per server, with a free Let’s Encrypt certificate that installs and renews automatically. Staging and live sit on the same server, so the search and replace runs on staging first. Migrations to us include database search and replace and URL corrections, which is exactly where mixed content tends to start.

Work is billed in credits: 1 credit is 1 hour at $42, no long-term contracts, and bundles save up to 21%. Every task comes with time logs and a screenshot every 10 minutes, so you can see the work. For ongoing care, our maintenance plans run Daily at $60, Weekly at $20 or Monthly at $10 per site.

Get Your Padlock Back Without Guesswork

Mixed content is easy to fix halfway. The padlock returns on the homepage, and then a customer emails a screenshot of the checkout with a warning on it, which is why finding every source, from the database down to the CDN field in a caching plugin you forgot you had, is what makes the fix stick.

If you’d rather hand it to someone who does this every week, create your Webueno account and open a ticket for the site. We’ll find the insecure URLs, fix them at the source and send you the before and after.

Frequently Asked Questions

These are the questions site owners ask most after switching a WordPress site to HTTPS.

Does Mixed Content Hurt SEO?

There’s no direct penalty, but blocked scripts and styles can break the page Google renders, and visitors leave faster when they see “Not secure”. Clean HTTPS also helps Google pick your HTTPS URLs as canonical.

Can I Fix Mixed Content Without a Plugin?

Yes. Update the site address, run a WordPress-aware search and replace, fix hardcoded theme URLs and add an HTTPS redirect. After that, no rewriting plugin is needed.

Why Do I Still See Mixed Content After Search and Replace?

Usually a cache is serving old HTML, a page builder’s CSS files still hold the old URLs, or the file comes from theme code or an external host. Purge caches, regenerate builder CSS and read the exact source in the console.

Is It Safe to Use Really Simple SSL Long Term?

It works, and plenty of sites run it for years. The risk is that the fix lives in the plugin, so deactivating it brings the warning back.

Will Search and Replace Break My Site?

It can if you use raw SQL or replace the wrong string. With a backup, a dry run and your exact domain, the risk is small. Try it on staging first if you have one.

What Is the Difference Between Mixed Content and an Invalid Certificate?

An invalid certificate means the HTTPS connection itself isn’t trusted, so the browser shows a full warning page before anything loads. With mixed content, the certificate is fine, but some files on the page still load over HTTP.

You may also like

Illustration of the three Core Web Vitals shown as three panels: LCP for loading speed, INP for responsiveness, and CLS for visual stability, with pass thresholds and a green scorecard theme.
What Is LCP, CLS, and INP and How to Fix Them

Ready to Move Your Website and Business Forward?

No contracts. No unnecessary complexity. Just reliable execution and real results.