You moved WordPress to HTTPS, installed the certificate, and expected the padlock. Instead the browser shows a warning, or no padlock at all. That is the classic sign of mixed content: the page loads over HTTPS, but some images, scripts, or stylesheets still load over plain HTTP. This guide shows you how to fix mixed content warnings in WordPress, from finding the insecure URLs to forcing HTTPS at the server level.
Browsers block active mixed content such as scripts and stylesheets outright, so parts of your site can break silently. Passive mixed content such as images still loads, but the page is marked “not secure” and visitors lose trust. WordPress https mixed content is one of the most common problems after a migration, and it is almost always fixable in under an hour once you know where the old HTTP URLs hide.
What Mixed Content Is and Why It Appears After Moving to HTTPS
A page has mixed content when its HTML loads over HTTPS but references at least one resource over HTTP. WordPress stores absolute URLs in the database, in post content, widgets, menus, and theme settings. When you switch the site to HTTPS, those stored URLs do not change by themselves. Every old http://yoursite.com/wp-content/uploads/photo.jpg keeps pointing at the HTTP version.
The same problem hides in theme files, plugin settings, and hardcoded links. A slider plugin that stores its image URLs, a theme option with a logo URL, or a custom CSS file that references an HTTP font can each trigger the warning.
Browsers treat two kinds of mixed content differently:
| Type | Examples | Browser behaviour |
|---|---|---|
| Active mixed content | JavaScript, CSS, iframes, fonts, XHR requests | Blocked completely; the feature breaks |
| Passive mixed content | Images, audio, video | Usually still loads, but the padlock disappears |
Active mixed content is the urgent one: a blocked script can break a menu, a checkout form, or an embedded map with no obvious error to the visitor. WordPress SSL insecure content warnings in the browser console tell you which type you are dealing with, so start there.
How to Find the Insecure URLs on Your Site
Before you change anything, find every HTTP resource the page actually loads. Open the page in your browser, press F12, and look at the Console tab. Each mixed content warning names the exact URL, for example Mixed Content: The page at 'https://yoursite.com/' was loaded over HTTPS, but requested an insecure image 'http://yoursite.com/wp-content/uploads/logo.png'.
Check the homepage first, then a single post, a category page, and any page with a form or slider, since different templates load different resources. Note every HTTP URL. Do not edit anything yet: back up first, because the fix involves a database search and replace.
Step 1: Back Up the Database, Then Update WordPress Site URL HTTPS Settings
Back up the database before touching any URL. A bad search and replace can break serialized data, and a backup is the only fast way back.
Next, confirm WordPress itself uses HTTPS. Go to Settings, then General, and check that both the WordPress Address (URL) and Site Address (URL) start with https://. If either still shows HTTP, change it and save. This is how you update WordPress site URL HTTPS settings from the dashboard, and it fixes every URL WordPress generates from now on, including new uploads and new links.
If the fields are greyed out, the URLs are hardcoded in wp-config.php with WP_HOME and WP_SITEURL. Edit those two constants to use https:// instead. From the terminal, WP-CLI does the same job, and it is worth learning to manage WordPress from the terminal with WP-CLI for jobs like this:
wp option update siteurl https://yoursite.com
wp option update home https://yoursite.com
Replace yoursite.com with your own domain. This step alone fixes the URLs WordPress generates, but it does not touch the old HTTP links already stored in posts and settings. That is the next step.
How to Fix Mixed Content Warnings in the Database
The bulk of the work is a search and replace across the database: change every http://yoursite.com to https://yoursite.com. WordPress stores some settings as serialized PHP arrays, where each string carries its own length. A plain SQL REPLACE() changes the string without updating the length, which corrupts the data. Use a tool that understands serialization.
WP-CLI handles this correctly. Run a dry run first so you can see what will change before anything is written:
wp search-replace 'http://yoursite.com' 'https://yoursite.com' --dry-run
Check the per-table summary, then run it for real:
wp search-replace 'http://yoursite.com' 'https://yoursite.com'
For multisite, add --network. Without WP-CLI, a plugin such as Better Search Replace does the same serialized-safe replacement from the dashboard. Keep the backup from Step 1 until you have checked the site.
After the replacement, reload the pages you checked earlier. If warnings remain, the leftover URLs are usually not in the database at all. They live in files, in plugin settings, or on an external domain.
Fix Hardcoded URLs in Your Theme, Plugins, and Widgets
Search your theme and plugin files from the WordPress root:
grep -r "http://yoursite.com" wp-content/themes/ wp-content/plugins/ --include="*.php" --include="*.css" --include="*.js"
Fix each match by changing the URL to HTTPS, or better, to a root-relative path such as /wp-content/uploads/logo.png. Root-relative paths never cause mixed content, because the browser uses the same scheme as the page. Do not edit plugin files directly if you can avoid it, since an update will overwrite your change. Where the URL comes from a plugin setting, change it in the plugin’s settings page instead.
Check these spots in particular, because they are the usual hiding places:
- Theme customizer: logo, favicon, background image, and footer text with links
- Widgets: text widgets and custom HTML widgets with old image URLs
- Sliders, page builders, and form plugins that store their own media URLs
- CSS files that load fonts or background images over HTTP
- External resources: Google Fonts, CDN scripts, or embeds loaded with an HTTP URL
For external resources, change the URL to its HTTPS version. Nearly every major CDN and font provider supports HTTPS today. If a service only offers HTTP, replace it or drop it.
Force HTTPS at the Server Level With Nginx
Fixing the stored URLs solves the content, but visitors can still reach the HTTP version of your site by typing the address without HTTPS or following an old link. A server-level redirect closes that gap. If you run Nginx, add a redirect in the HTTP server block so every request moves to HTTPS:
server {
listen 80;
server_name yoursite.com www.yoursite.com;
return 301 https://yoursite.com$request_uri;
}
Test the config with nginx -t before reloading, then reload with systemctl reload nginx. If you have not set up the certificate yet, first install a free Let’s Encrypt certificate with Certbot on the same server, and read the full guide on how to redirect HTTP to HTTPS in Nginx if your setup uses separate server blocks or a control panel. If you are starting from scratch, the order is: point the domain at the server, get the certificate, then add the redirect. Our guide on how to point a domain at your VPS and set up free HTTPS walks through that sequence.
Add the Strict-Transport-Security header only after you are sure HTTPS works everywhere, since HSTS tells browsers to refuse HTTP for months at a time. Check your setup against a guide to secure Nginx security headers.
Clear Caches and Verify the Fix
Old HTTP URLs survive in caches long after the database is fixed. Clear every layer, in this order: any caching plugin, the server-side page cache such as Nginx FastCGI cache if you use one, the CDN cache, and finally your own browser cache. Then reload the pages and check the console again.
Verify the fix properly instead of trusting one page load:
- Open the homepage, a post, a page with a form, and a page with a slider, and confirm the padlock shows on each
- Check the browser console on each page and confirm zero mixed content warnings
- Test with
curlfrom the server:curl -s https://yoursite.com/ | grep -o 'http://yoursite.com[^"]*' | sort -ushould print nothing
If one page still warns, the console names the exact resource. Fix that URL at its source instead of adding a plugin to paper over it. A redirect or a rewrite rule can mask a single leftover, but the clean fix is to correct the stored URL.
Keep Mixed Content From Coming Back
Mixed content returns when new HTTP URLs creep in: a contributor pastes an HTTP image, a new plugin ships with an HTTP default, or an imported post carries old links. Keep the server redirect in place, keep the site URL on HTTPS, and check the padlock and the console after any migration, theme change, or bulk import. It takes thirty seconds and catches the problem while the change is still fresh.