Guide
Mixed content errors: what they are and how to fix them
A mixed content error happens when a secure HTTPS page loads some resources, such as images or scripts, over insecure HTTP, so the browser warns or blocks them. Find the insecure addresses with your browser’s developer tools, and change them to HTTPS. In WordPress, set your site address to HTTPS, update old links in the database and clear caches.
The basics
Why a padlock goes missing
When you add an SSL certificate, your site can be loaded over HTTPS, and browsers show a padlock. But a web page is made of many parts: the page itself, plus images, stylesheets, scripts and fonts. If even one of those is still requested over plain HTTP, the page is only partly secure.
Browsers treat this as mixed content. For risky items, such as scripts and stylesheets, they block the request, which can break the layout or features. For less risky items, such as images, they may load them but remove the padlock or show a warning, which makes visitors worry.
It usually appears after moving a site to HTTPS, when the old address is still written into pages, menus and settings. It is common and easy to fix once you know where to look. Our guide to moving from HTTP to HTTPS covers the full move.
Types
Two kinds of mixed content
| Kind | Examples | What browsers do |
|---|---|---|
| Active mixed content | Scripts, stylesheets, iframes | Block them, which can break layout or features |
| Passive mixed content | Images, audio, video | May load them but remove the padlock or show a warning |
Modern browsers also try to upgrade some insecure requests to HTTPS automatically, but you should not rely on that.
Finding it
How to find the insecure items
Open the page in your browser
Visit the page showing the warning, over HTTPS.
Open developer tools
Press F12, or right-click the page and choose Inspect, then open the Console tab.
Read the messages
Look for messages saying a resource was loaded over HTTP. Each names the address of the insecure item.
Note each address
Write down the addresses and which pages they appear on. Many will share the same cause.
Check the Network tab
Reload with the Network tab open and look for requests beginning http:// instead of https://.
Worked example
A worked example: a logo that kept the padlock away
A bookkeeping firm installs a free SSL certificate and visits its site over HTTPS. The padlock shows a warning on every page. The owner opens the Console and finds one message: an image at http://bookkeepersite.co.uk/wp-content/uploads/logo.png was loaded over HTTP.
The logo had been added years ago with an HTTP address, and the theme’s header setting still held it. She edits the header setting to use the HTTPS address. She reloads the page, the warning disappears and the padlock returns.
She also checks other pages and finds two older blog posts with images using HTTP. She fixes those with a search and replace tool, after taking a backup, and clears the cache. The whole job takes twenty minutes and removes the warning from every page.
In WordPress
Fixing mixed content in WordPress
In WordPress, start with Settings, General, and make sure both the WordPress Address and the Site Address begin with https://. Then update old links stored in the database, where posts, pages and widgets may hold the old HTTP addresses.
A search and replace tool can change http://yourdomain to https://yourdomain across the database safely, as long as you take a backup first and use the tool’s dry-run option. Page builders and themes may store addresses separately, so check their settings too.
Finally, clear every cache, including your caching plug-in, the server cache and your browser. Old cached pages can keep showing old addresses long after you have fixed them. Our guide to free SSL certificates explains what is included with every plan.
Common mistakes
Mistakes to avoid
The most common mistake is fixing one page and forgetting the rest. Resources such as headers, footers and widgets appear on every page, so one wrong address causes a warning site-wide. Fix the source, not the symptom.
Another is using a plug-in that rewrites addresses on the fly without fixing the underlying data. It can work, but it adds load and hides the problem. A third is using hard-coded HTTP addresses for fonts, analytics or embeds from other sites. Use their HTTPS versions, or protocol-relative links where the provider supports them.
Also, never turn off the warning in a browser setting to “fix” it. That only hides the problem on your own computer, and your visitors still see it. Fix the cause, then test on a phone and a different browser.
Checklist
A mixed content checklist
- WordPress Address and Site Address use https://
- The Console shows no mixed content messages
- Old posts and pages were searched and fixed
- Theme and page builder settings use HTTPS addresses
- Fonts, scripts and embeds use HTTPS
- All caches were cleared
- You took a backup before bulk changes
- You tested on a phone and a second browser
Beyond WordPress
Mixed content on other kinds of site
The same problem appears on any website, not only WordPress. On a hand-coded site, search your files for http:// addresses and change them to https://. On sites built with other tools, check theme and template files, because addresses are often written into headers and footers.
Third-party embeds are a frequent cause, such as maps, videos, fonts and widgets. Most providers now offer HTTPS versions, so copy the current embed code and replace the old one. If a provider only supports HTTP, replace it with one that does, because browsers will increasingly block it.
A content security policy can help you enforce HTTPS across a larger site, by telling browsers to upgrade insecure requests automatically. It is an extra tool for developers, and worth knowing about if your site is large or complicated.
After the fix
Checking that it stays fixed
Mixed content has a habit of returning. A new post with an HTTP image, or a plug-in that adds an old address, brings it back. Make HTTPS a habit: when you paste an address into a page, check it begins with https://.
Run a free site-wide checker every few months. It crawls your pages and lists any insecure resources, saving you from clicking through every page by hand. Fix what it finds, and note the date, so you know your padlock has been checked.
Security layers on every plan
Imunify360, a ModSecurity firewall, DDoS protection, free SSL and weekly remote backups, from 84p a month (£10.03 billed yearly).
FAQ
Common questions
What is mixed content?
A secure HTTPS page that also loads some resources over insecure HTTP, which makes browsers warn or block them.
Why did my padlock disappear?
Something on the page, usually an image or script, is still requested over HTTP. Find it with the browser console.
How do I find the insecure items?
Open the Console in developer tools and read the messages. They name the insecure address.
How do I fix it in WordPress?
Set both addresses to HTTPS, replace old HTTP links in the database after a backup, and clear all caches.
Will mixed content hurt SEO?
HTTPS is a small ranking signal, but broken layouts and security warnings cost you visitors, which matters more.
Do I need a plug-in?
A search and replace tool is helpful, but you can often fix the source directly in settings.
Why do I still see it after fixing?
Caches. Clear your caching plug-in, the server cache and your browser cache.
Does free SSL cover this?
Free SSL provides the certificate, but you still need to make sure every resource is requested over HTTPS.
Keep reading
Related pages
Host your site with security built in
Imunify360, a firewall and free SSL on every plan, with a 15-day money-back guarantee.