All posts
Blog

WordPress Mixed Content: How to Find and Fix Every "Not Secure" Warning

By DaksheshUpdated 13 min read

  • wordpress
  • wordpress errors
  • wordpress security
  • technical SEO
Continue with GoogleFree plan · No credit card required

Listen to this article

16 minute listen

Narrated by an AI voice · 11 chapters

0:00-15:50

AI Overview

WordPress mixed content means an HTTPS page still loads images, scripts or stylesheets over HTTP, so browsers block them or show "Not secure." Fix it by setting both WordPress URLs to https, running a serialization-safe database search-replace, fixing hardcoded theme and page builder URLs, using Full (strict) SSL on Cloudflare, and clearing every cache.

Key takeaways

  • Mixed content is an HTTPS page loading scripts, styles, fonts or images over HTTP.
  • The browser console names every insecure file, so start there.
  • Set WordPress Address and Site Address to https, then search-replace the database with WP-CLI or Better Search Replace.
  • Hardcoded URLs in themes, CSS, widgets and Elementor need fixing separately.
  • Cloudflare Flexible SSL causes mixed content and redirect loops; use Full (strict).

Free WordPress plugin

Know which plugin update broke your site.

The free MyKavo plugin watches your site through every plugin, theme and core update, and tells you which one caused a change, before your visitors find it.

  • Records every plugin, theme and WordPress update
  • Checks your key pages right after each update and names the one that broke something
  • One-click rollback when an update goes wrong, free
  • Changes, alerts and before-and-after proof inside wp-admin

Free on WordPress.org · WordPress 6.2+ · PHP 7.4+ · The check after each update comes with every paid plan

Summarize with AI

Opens the assistant in a new tab with a link to this post.

On this page

Your WordPress site has a valid SSL certificate, but the browser still shows "Not secure," a broken layout, or a warning that the connection isn't fully secure. The cause is almost always mixed content: a page loaded over HTTPS that still pulls some images, scripts, stylesheets or fonts over plain HTTP.

This guide explains why browsers block mixed content, how to find every insecure URL, and how to fix it at the source: WordPress settings, the database, your theme, page builders, plugins and your CDN. It ends with how to keep it from coming back.

Fixed it once and want it to stay fixed? The free MyKavo WordPress plugin checks your pages after every plugin, theme and core update and shows you exactly what changed. Start monitoring free.

Quick answer: how to fix mixed content in WordPress#

  1. Back up your files and database before changing anything.
  2. Set WordPress Address (URL) and Site Address (URL) to https:// in Settings > General.
  3. Search and replace old URLs in the database, from http://example.com to https://example.com, with WP-CLI wp search-replace (dry run first) or the Better Search Replace plugin.
  4. Find what's left with the browser console and fix hardcoded http:// URLs in your theme, CSS, widgets and page builder.
  5. Check your CDN settings: on Cloudflare, use Full (strict) SSL, not Flexible.
  6. Force HTTPS with a 301 redirect and clear every cache (plugin, server, CDN, browser).
  7. Optionally add upgrade-insecure-requests as a safety net, then recheck your key pages.

What mixed content is#

When a page loads over HTTPS, everything on it should too. If the HTML is secure but it requests http://example.com/logo.png, that insecure request is mixed content. Anyone on the same network could read or tamper with the HTTP part, so browsers treat it as a security problem.

There are two kinds, and browsers handle them differently:

TypeExamplesWhat current browsers do
Active (blockable)Scripts, stylesheets, iframes, web fonts, fetch/XHR requestsBlocked outright
Passive (upgradable)Images, audio, videoChrome and Firefox try the HTTPS version automatically and block it if that fails

The symptoms follow from that:

  • Blocked scripts break sliders, menus, forms, cookie banners, payment widgets and analytics (a common reason Google Analytics stops tracking).
  • Blocked stylesheets or fonts make the layout look unstyled or switch to fallback fonts.
  • Images that can't be upgraded show as broken, and the browser may drop the secure indicator.

Because browsers auto-upgrade many images, a site can look fine in one browser and broken in another, so check the console rather than judging by eye.

Why WordPress sites end up with mixed content#

  • The site switched to HTTPS after content was created. WordPress stores full URLs in posts, custom fields, widgets and options, so old content keeps its http:// links.
  • Hardcoded URLs in the theme, such as a logo path in header.php or a background image in CSS.
  • Page builder data. Elementor, Divi and similar builders store URLs in their own data and generated CSS files.
  • Old embed code in a Custom HTML block or widget.
  • A website migration from a copy that ran on HTTP or another domain.
  • A CDN or proxy that talks to your server over HTTP, so WordPress generates http:// URLs.

How to find mixed content on your site#

Collect a list of insecure URLs first. Check more than the homepage: posts, pages, product pages, the cart and checkout often load different assets.

1. Use the browser console#

Open the page in Chrome, Edge or Firefox, press F12 (or Cmd+Option+I on a Mac) and open the Console tab. Each problem shows as a message like this:

Mixed Content: The page at 'https://example.com/' was loaded over HTTPS,
but requested an insecure script 'http://example.com/wp-content/themes/mytheme/js/slider.js'.
This request has been blocked; the content must be served over HTTPS.

In Chrome's Network tab, typing mixed-content:all in the filter box lists every insecure request.

2. Use an online scanner#

Free scanners such as Why No Padlock list every insecure item on a URL. To see every script a page loads, run it through the MyKavo script detector and look for sources starting with http://.

3. View the page source#

Press Ctrl+U (Cmd+Option+U on a Mac) and search for http://. Focus on src=, srcset=, <link rel="stylesheet" and url( in inline CSS. A plain link (<a href="http://...">) is not mixed content, because it loads nothing into your page.

4. Search the database and theme files#

If you have WP-CLI, this shows which tables still contain the old URL:

wp db search 'http://example.com' --stats

For theme files, search from the WordPress root over SSH:

grep -rn "http://" wp-content/themes/your-child-theme

How to fix mixed content in WordPress, step by step#

Work through these in order. The first three fix most sites.

Step 1: Back up, and use staging if you have it#

A search-replace changes thousands of database rows at once. Take a full backup of files and database first, and use a staging copy if your host offers one.

Step 2: Set both WordPress URLs to HTTPS#

Go to Settings > General and make sure both fields start with https://:

  • WordPress Address (URL)
  • Site Address (URL)

Save, and you'll be logged out. Log back in over HTTPS.

If the fields are greyed out, the URLs are defined in wp-config.php. Edit them there:

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

Since WordPress 5.7, Tools > Site Health may show an Update your site to use HTTPS button when your server supports HTTPS but the site URLs don't. It switches both URLs and rewrites old links to your own domain as pages are displayed. Useful, but the database search-replace below is still the permanent fix.

Step 3: Search and replace old URLs in the database#

Don't run a plain SQL REPLACE(). WordPress stores many settings as serialized PHP data, which records each string's length. Adding the "s" in https breaks that count and can wipe widget or plugin settings. Use a tool that understands serialization.

With WP-CLI (fastest, if you have SSH access):

wp db export before-https.sql
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
  • --dry-run previews the replacements per table without changing anything.
  • --skip-columns=guid leaves post GUIDs alone; they're identifiers, not links.
  • Repeat for http://www.example.com if the site was ever served on www, and add --all-tables-with-prefix to include plugin tables.

With a plugin: in Tools > Better Search Replace, enter the old and new URL, select your tables, run once with Run as dry run checked, then uncheck it and run again.

Step 4: Fix hardcoded URLs in your theme, CSS and widgets#

A database search won't reach code in theme files. Check these places:

  • Theme template files such as header.php and footer.php. Edit a child theme, not the parent, or the next theme update will overwrite your fix.
  • Appearance > Customize > Additional CSS, especially background-image: url(http://...).
  • Custom HTML blocks and widgets with old embed codes, tracking snippets or iframes.
  • Header and footer script plugins holding analytics or chat code.

Replace http:// with https://. If a third-party file isn't available over HTTPS at all, replace the service or host the file yourself.

Step 5: Update page builder URLs#

Page builders may store URLs in a format a plain search won't match; Elementor uses JSON with escaped slashes (http:\/\/example.com).

  • Elementor: go to Elementor > Tools > Replace URL, enter the old and new URL, and click Replace URL. Then regenerate CSS from the General tab of the same screen.
  • Other builders: run the serialization-aware search-replace from Step 3, then clear the builder's generated CSS from its own settings.

Step 6: Use a plugin as a safety net#

If you can't track down every URL, a plugin can rewrite insecure links as each page is sent to the browser:

  • Really Simple Security (formerly Really Simple SSL) detects your certificate, switches the site to HTTPS and includes a mixed content fixer.
  • SSL Insecure Content Fixer focuses only on rewriting insecure URLs, with several levels of fixing.

They patch the output on every page load instead of fixing the source, so use them to cover gaps, not to skip Steps 2 to 5.

Step 7: Add the upgrade-insecure-requests header#

The Content-Security-Policy directive upgrade-insecure-requests tells browsers to request every http:// resource on your pages over HTTPS instead. On Apache or LiteSpeed, add this to .htaccess:

<IfModule mod_headers.c>
Header always set Content-Security-Policy "upgrade-insecure-requests"
</IfModule>

On Nginx, add it inside the server block and reload:

add_header Content-Security-Policy "upgrade-insecure-requests" always;

It only helps when the resource exists on HTTPS, and if your site already sends a Content-Security-Policy header, add the directive to that policy instead of sending a second one.

Step 8: Check Cloudflare and CDN settings#

  • Cloudflare Flexible SSL encrypts visitor-to-Cloudflare traffic, but Cloudflare talks to your server over plain HTTP. WordPress may then generate http:// URLs, and if your server also forces HTTPS, visitors bounce in a loop: the classic cause of ERR_TOO_MANY_REDIRECTS.
  • The fix: install a certificate on your server (most hosts provide one free) and set Cloudflare's SSL/TLS mode to Full (strict).
  • Cloudflare's Automatic HTTPS Rewrites setting is another useful safety net.
  • If your CDN has its own hostname, make sure the CDN URL in your cache or CDN plugin starts with https://.

If WordPress sits behind a proxy or load balancer that ends HTTPS, add this to wp-config.php above the "That's all, stop editing!" line:

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

Only use this when a trusted proxy sets that header.

Step 9: Force HTTPS and clear every cache#

Redirect all HTTP traffic to HTTPS with a permanent redirect. On Apache, put this in .htaccess above the # BEGIN WordPress block:

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

Many hosts offer a "Force HTTPS" toggle instead. Use one method, not several, or you risk a redirect loop.

Then clear every cache: plugin, server, CDN and browser, because cached pages still hold the old URLs. Reload your key pages and confirm the console is clean.

Mixed content fixes at a glance#

Where the http:// URL livesHow to fix it
WordPress URL settingsSettings > General, or WP_HOME and WP_SITEURL in wp-config.php
Post content, custom fields, widgetswp search-replace or Better Search Replace
Theme files and Additional CSSEdit the child theme and Customizer CSS by hand
Elementor dataElementor > Tools > Replace URL, then regenerate CSS
Third-party embeds and scriptsReplace with HTTPS embed code, or remove the service
Cloudflare or CDNFull (strict) SSL, HTTPS CDN URL
Gaps you can't findA fixer plugin or upgrade-insecure-requests

How to keep mixed content from coming back#

Mixed content comes back when something new is added:

  • A plugin or theme update ships with a hardcoded http:// asset.
  • Someone pastes old embed code for a video, form, map or tracking pixel.
  • A page builder template or staging push brings http:// URLs back into the database.
  • The SSL certificate expires, a different problem with a similar warning. See fixing "Your connection is not private", and use the free SSL certificate checker to see when yours expires.

After adding any embed, plugin or template, open the page with the console visible. Pair that habit with automated checks after updates, because nobody opens the console on every page every week.

How to catch this automatically#

MyKavo monitors the pages that matter and compares each scan to an approved baseline. It alerts you when a script is added or removed, so a new script loaded from an http:// URL, or an analytics or payment script that disappears after an update, shows up with before-and-after proof. Before-and-after screenshots catch the broken layout you get when a stylesheet stops loading, and MyKavo warns you before your SSL certificate expires.

For WordPress, the free MyKavo WordPress plugin checks your pages after every plugin, theme and core update, names the update when something broke, and shows the screenshots inside wp-admin, adding nothing to the pages visitors load. The Free plan covers one website with weekly scans; paid plans scan daily.

Frequently asked questions#

Frequently asked questions

What does mixed content mean in WordPress?

A page loaded over HTTPS also loads some images, scripts, stylesheets or fonts over plain HTTP. Browsers block the insecure scripts and styles and may drop the secure indicator, which can break your layout and features.

Why does my WordPress site say not secure after installing SSL?

Usually because old http:// URLs remain in your database, theme files or page builder data, or the WordPress Address and Site Address settings still use http://. Update both settings, run a database search-replace, and fix whatever the browser console still reports.

How do I find mixed content on my site?

Open the page, press F12, and check the Console tab for "Mixed Content" messages that name each insecure file. You can also filter the Network tab with mixed-content:all, view the page source and search for http://, or use an online scanner such as Why No Padlock.

Is it safe to use a search and replace on the WordPress database?

Yes, if you back up first and use a tool that handles serialized data, such as WP-CLI wp search-replace or the Better Search Replace plugin. Run a dry run first and skip the guid column. Avoid plain SQL REPLACE queries, which can corrupt serialized settings.

Do I need a plugin like Really Simple SSL to fix mixed content?

No. Plugins such as Really Simple Security (formerly Really Simple SSL) rewrite insecure URLs as pages load, which is a useful safety net, but fixing the URLs in your settings, database and theme is the cleaner long-term fix.

Can Cloudflare cause mixed content or redirect loops?

Yes. With Flexible SSL, Cloudflare connects to your server over HTTP, so WordPress may generate http:// URLs, and a server-side HTTPS redirect can create an endless loop. Install a certificate on your server and switch Cloudflare to Full (strict).

The bottom line#

Mixed content means your HTTPS pages still load something over HTTP. Back up, set both WordPress URLs to HTTPS, run a serialization-safe search-replace, clean up hardcoded theme and page builder URLs, check your CDN's SSL mode, force HTTPS, and clear every cache. Treat plugins and upgrade-insecure-requests as a safety net, and recheck after every update.

Keep your HTTPS fix from quietly breaking. Start monitoring your site free with MyKavo and install the free MyKavo WordPress plugin, no card needed.

Try it on your site · free

Check your own page's meta tags

Title, description, canonical and robots - including an accidental noindex - in a few seconds.

Open the full tool
Share this post

Write for MyKavo

Know website monitoring, WordPress or SEO from real work? Pitch us a guide. You keep a byline with one link to your site. Read the guidelines

Get alerted when your site breaks. Free, no card.

Start free