Fix Mixed Content Errors on WordPress (HTTPS Padlock Gone)
Mixed content errors block HTTPS on WordPress. Find and fix insecure HTTP resources in the database, theme files, and Elementor data without breaking your site.
- Published

A mixed content error means your site loads over HTTPS but one or more resources—images, stylesheets, scripts, or iframes—are still requested over HTTP. Browsers block or warn about insecure requests on secure pages, which breaks the padlock icon and degrades visitor trust. The fix is to update every HTTP URL stored in your WordPress database and theme files to use HTTPS.
This problem almost always appears after migrating a site from HTTP to HTTPS, moving to a new domain, or enabling SSL through your host or Cloudflare. The site URL settings were updated, but the existing content still references the old HTTP addresses.
Confirm the error and find the offending URLs
Before changing anything, identify exactly which resources are loading over HTTP:
-
Open your site in Chrome or Firefox.
-
Press F12 to open Developer Tools, then click the Console tab.
-
Look for warnings like:
Mixed Content: The page at
https://example.com/was loaded over HTTPS, but requested an insecure image athttp://example.com/wp-content/uploads/photo.jpg. -
Each warning names the exact insecure URL. Note down the domain—it is almost always your own domain with
http://instead ofhttps://.
The Network tab can also help: filter by the red triangle (blocked) or yellow warning indicators to see every failed or warned resource.
Before you make any changes
A search-and-replace across the WordPress database is a destructive operation. Prepare properly:
- Export a full database backup from your hosting control panel (phpMyAdmin, cPanel, or your host’s one-click backup tool).
- Store the backup off-server on your local machine.
- Confirm you know how to restore it if something goes wrong.
1. Correct the WordPress Address and Site Address
WordPress must know its own HTTPS address before anything else:
- Go to Settings → General in your WordPress dashboard.
- Confirm that both WordPress Address (URL) and Site Address (URL) begin with
https://, nothttp://. - If either says
http://, update it and click Save Changes. WordPress will log you out; this is expected.
If you are locked out of the dashboard because of an existing redirect loop, add these lines to wp-config.php temporarily:
define( 'WP_HOME', 'https://yourdomain.com' );
define( 'WP_SITEURL', 'https://yourdomain.com' );
Log in, correct the settings in Settings → General, then remove these lines from wp-config.php.
2. Replace HTTP URLs in the database (Better Search Replace)
Post content, widget data, custom fields, and meta values often contain absolute HTTP URLs that need to be updated in the database. Use the free Better Search Replace plugin to do this safely:
- Install and activate Better Search Replace from the WordPress plugin repository.
- Go to Tools → Better Search Replace.
- In Search for: enter
http://yourdomain.com(your actual domain, with no trailing slash). - In Replace with: enter
https://yourdomain.com. - Select all database tables in the list below.
- Check Run as dry run and click Run Search & Replace.
- Review the results—they show how many replacements would be made per table.
- If the numbers look reasonable (typically hundreds to low thousands for a standard WordPress site), uncheck Run as dry run and click Run Search & Replace again to apply the changes.
- Deactivate and delete the plugin once the replacement is confirmed.
Elementor-specific URL replacement
If you use Elementor, it stores page data serialized in the database in a separate format. Run Elementor’s own replacement tool after Better Search Replace:
- Go to Elementor → Tools → Replace URL.
- Enter
http://yourdomain.comin the From URL field andhttps://yourdomain.comin the To URL field. - Click Replace URL.
- On the same page, click Regenerate Files & Data to rebuild Elementor’s CSS cache with the updated URLs.
3. Fix hardcoded URLs in theme or plugin files
If mixed content warnings persist after the database replacement, HTTP URLs are hardcoded in your theme files or a plugin:
- Use your hosting file manager or an SFTP client to search your theme folder (
wp-content/themes/your-theme/) for occurrences ofhttp://yourdomain.com. - Replace absolute HTTP paths with HTTPS equivalents, or use protocol-relative paths (remove the
http:part, leaving//yourdomain.com/...) so the browser uses whatever protocol the page is on. - For third-party scripts hardcoded in
<script>or<link>tags, update to their HTTPS equivalents. Most CDN-hosted libraries serve from HTTPS by default.
For custom CSS stored in the WordPress Customizer or inline style blocks, check Appearance → Customize → Additional CSS for any http:// background-image URLs and update them.
4. Handle external resources and embeds
Resources loaded from external domains you do not control—such as an affiliate badge, an older analytics snippet, or an iframe embed—must be confirmed as HTTPS-capable on the external service’s end. If the external service does not offer HTTPS, remove the resource or find an alternative.
Common external mixed content sources:
- Embedded YouTube videos: Replace
http://www.youtube.com/embed/...withhttps://www.youtube.com/embed/.... - Embedded maps or social widgets: Update the embed code from the source platform.
- Google Analytics, fonts, or tag manager scripts: These all serve from HTTPS by default; ensure your copy-pasted snippets use
https://.
5. Use SSL Insecure Content Fixer as a fallback
If third-party plugins or theme components continuously inject HTTP resources that you cannot modify directly, the SSL Insecure Content Fixer plugin intercepts page output and rewrites insecure URLs on the fly:
- Install and activate the plugin.
- Go to Settings → SSL Insecure Content.
- Select the Content fix level (rewrites URLs in post content, widgets, and common shortcodes).
- Save and reload your site.
Use this as a permanent solution only if you cannot identify and fix the root cause in theme or plugin files. Runtime rewriting adds a small processing overhead to every page load.
6. Force HTTPS for all traffic at the server level
A server-level HTTPS redirect ensures that any HTTP request (including direct URL entry or old bookmarks) is redirected to HTTPS before WordPress loads. This does not fix mixed content URLs already stored in the database, but it prevents new HTTP traffic from reaching your site.
Apache (.htaccess):
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Cloudflare: In the Cloudflare dashboard, go to SSL/TLS → Edge Certificates and enable Always Use HTTPS.
Confirm this redirect is in place after fixing the database URLs to ensure no HTTP references remain accessible.
Verify the fix
- Reload your homepage in Chrome and check the browser address bar—it should show a padlock icon with no warning indicator.
- Open Developer Tools → Console and confirm no mixed content warnings appear.
- Test a few inner pages that previously showed warnings (posts, media-heavy pages, contact form pages).
- Use Why No Padlock? or a similar free tool to run an external mixed content audit and confirm clean results.
Rollback and escalation
If mixed content warnings persist after all steps:
- Restore your database backup and start again with a more targeted search using a staging environment.
- Some page builders store content as base64-encoded serialized data; a standard string replace does not decode it. In those cases, the plugin’s own migration tool (like Elementor’s Replace URL) is the correct path.
- If you recently moved to a new domain (not just HTTP to HTTPS), you need to search for both the old
http://andhttps://versions of the old domain. - For SSL certificate issues causing the browser to block HTTPS entirely, see our Cloudflare SSL pending validation guide or Cloudflare Error 521 guide.
Source and version notes
This guide was verified against WordPress 6.7, Better Search Replace 1.4.7, and SSL Insecure Content Fixer 3.3. MDN mixed content definitions follow the W3C Mixed Content specification. Chrome’s mixed content blocking behavior may differ from Firefox and Safari for passive content such as images.


