WordPress without a padlock after installing SSL: how to fix mixed content
WordPress loses its padlock after you install SSL when the page opens over https but still loads some item (an image, script, font or CSS file) from an http address. This is called mixed content. The fix is to find those addresses in the browser console, change them to https and, finally, force the redirect from http to https.
This article is for anyone who has already installed the certificate, but the browser still shows “Not secure” or a padlock with a warning. It covers how to identify the problem, how to fix the content, how to force https and how to check the certificate.
Before you start
- Make a copy of the site and the database before changing anything. See how to back up WordPress.
- Confirm that the certificate is installed on the domain. If it isn’t, start with how to install SSL on cPanel.
What is mixed content?
Mixed content happens when a page loaded over https pulls some resource over http. Browsers flag or block that resource, because it could be altered along the way.
| Type of http item | What usually happens |
|---|---|
| Image | The padlock disappears or shows a warning |
| Script (JavaScript) | The browser usually blocks it, and menus, sliders and forms may stop working |
| CSS or font | The browser usually blocks it, and the site’s look breaks |
Plain link (<a href>) |
Not mixed content: it only takes the visitor to an http page when clicked |
How do I find http items in the browser console?
The console lists each resource with a problem, along with its exact address.
- Open the page that has no padlock.
- Press
F12(or right-click and choose Inspect). - Open the Console tab and look for messages that mention “Mixed Content”. They show the http address that was loaded or blocked.
- Note the addresses and look for what they have in common: the uploads folder, a plugin or an external service.
- Repeat the check on other pages, such as the homepage and a post with images, because each one may have different items.
Step 1: check the site address in the settings
- In the dashboard, open Settings > General.
- The WordPress Address (URL) and Site Address (URL) fields should start with
https://. - If either starts with
http://, change it tohttps://yourdomain.comand save.
If the fields appear locked, the address may be fixed in wp-config.php. For the full step-by-step change, follow how to change the domain or address of your WordPress site. Be careful: if the certificate isn’t active yet, switching to https can make the dashboard inaccessible.
Step 2: change http to https in the content
Images and links inserted before SSL was installed are stored in the database with http://. The safest way to change them is with a search-and-replace tool, after backing up the database.
- Install a database search-and-replace plugin. See how to install a plugin in WordPress.
- In Search, enter
http://yourdomain.com. In Replace with, enterhttps://yourdomain.com. - If the plugin has a test mode (“dry run”), run it first. It shows how many replacements it would make without saving anything.
- If the result looks right, run it for real.
With WP-CLI, the equivalent command is:
wp search-replace 'http://yourdomain.com' 'https://yourdomain.com' --dry-run
Remove --dry-run to apply the changes. Only replace the address of your own site: replacing every http:// with https:// would break third-party addresses that don’t have https. If Elementor or another page builder stores the address in its own format, check whether it has a URL replacement tool, and clear its cache afterward.
Step 3: fix theme and plugin files
If the console still points to http items, the address is written directly into some file.
- In the cPanel File Manager, go to
wp-content/themes/theme-nameand download a copy of the files you are going to change. - Search for
http://yourdomain.cominheader.php,footer.php,functions.phpand the CSS files. Replace it withhttps://yourdomain.com. - For a third-party theme, prefer a child theme or an update, because direct changes are lost when the theme is updated.
- If the http address comes from a plugin or an external service, check for an update or a URL field in the settings. If the service doesn’t offer https, replace the resource.
Step 4: force https with a redirect
Even after fixing the content, anyone who types http://yourdomain.com should be taken to the secure address.
Through cPanel: if your control panel has the option to force HTTPS redirects in the Domains section (the name may vary), turn it on for the domain.
Through .htaccess: download a copy of the file (check Show Hidden Files in the File Manager) and add these lines before # BEGIN WordPress:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [L,R=301]
Save and test. If you get a 500 error, restore the copy. See also WordPress .htaccess: how to find and create the default file. If the site sits behind a CDN or proxy, this rule can create a redirect loop; follow the service’s guidance.
Step 5: clear the cache and check the certificate
- Clear the cache of your caching plugin, your browser and your CDN, if you use one. See what a cache plugin is for.
- Open the site in an incognito window.
- Click the icon next to the address and open the certificate details. Check that it was issued for your domain (with and without
www, if you use both) and that it is still valid. - Open the console again and confirm there are no “Mixed Content” messages left.
If the browser warns that the certificate is not valid, the problem is not mixed content: the certificate is missing, expired or issued for a different name, and it needs to be reinstalled or renewed in cPanel.
Frequently asked questions
Why does my WordPress site still say “Not secure” even with SSL?
Because the page opens over https, but one of its items is still loaded over http (mixed content), or because visitors reach the http address without a redirect. Use the console to find the items and force https.
What does Mixed Content mean in the browser console?
It means a page served over https tried to load a resource over http. The message gives the resource’s address, and with it you can tell whether it comes from the content, the theme, a plugin or an external service.
Do I need to reinstall the SSL if the padlock doesn’t appear?
Usually not. If the certificate is valid and was issued for your domain, the problem is in the content or the redirect. Only reinstall the certificate if the browser reports a certificate error.
Is it safe to replace http with https in the database?
Yes, if you make a backup first, replace only the address of your own site, and test with the “dry run” mode. Avoid replacing every http:// with https:// in a generic way.
Can the redirect to https cause a 500 error?
It can, if the rule is mistyped or conflicts with another rule in .htaccess. That’s why you should make a copy of the file before editing it. If the error appears, restore the copy and check 500 error or white screen in WordPress.
The padlock is back, but one page still shows a warning. Why?
That page probably has an http item of its own, such as an image inserted by hand, an iframe or an HTML block. Open the console on that page and correct the address in the editor.
If you would rather have help fixing the certificate or the mixed content without editing files yourself, contact MigraCloud.