WordPress Mixed Content Errors After SSL
Seeing insecure content warnings after installing SSL? Fix mixed content errors in WordPress.
What is Mixed Content?
When HTTPS site loads some resources (images, scripts, CSS) via HTTP instead of HTTPS.
Browser Warnings
- Padlock icon with warning
- “Not Secure” message
- Shield icon in address bar
- Content blocked message
Solution 1: Update Site URLs
Via WordPress Admin
- Settings → General
- Change WordPress Address to https://
- Change Site Address to https://
- Save Changes
Via wp-config.php
define('WP_HOME', 'https://yourdomain.com');ndefine('WP_SITEURL', 'https://yourdomain.com');
Solution 2: Update Database URLs
Using Better Search Replace Plugin
- Install Better Search Replace
- Search for: http://yourdomain.com
- Replace with: https://yourdomain.com
- Select all tables
- Run as dry run first
- Run actual replacement
Via WP-CLI
wp search-replace 'http://yourdomain.com' 'https://yourdomain.com' --all-tables
Solution 3: Force HTTPS via .htaccess
Add to top of .htaccess:
RewriteEngine OnnRewriteCond %{HTTPS} offnRewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Solution 4: Force HTTPS in WordPress
Add to functions.php:
function force_ssl() {n if (!is_ssl()) {n wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301);n exit();n }n}nadd_action('template_redirect', 'force_ssl');
Solution 5: Fix Content Security Policy
Add to .htaccess:
Header always set Content-Security-Policy "upgrade-insecure-requests;"
Solution 6: Use SSL Insecure Content Fixer Plugin
- Install SSL Insecure Content Fixer
- Activate plugin
- Settings → SSL Insecure Content
- Select fixing level
- Test site
Solution 7: Update Hard-Coded URLs
In Theme Files
- Search theme files for http://
- Replace with https://
- Or use relative URLs (/path/to/file)
In Widgets
- Check all widgets
- Update any HTTP URLs
- Use relative URLs
Solution 8: Fix External Resources
Google Fonts
Change from:
<link href="http://fonts.googleapis.com...">
To:
<link href="https://fonts.googleapis.com...">
Or Use Protocol-Relative URLs
<link href="//fonts.googleapis.com...">
Solution 9: Check for Mixed Content
Browser Developer Tools
- Open site in Chrome/Firefox
- Press F12
- Check Console tab
- Look for mixed content warnings
- Fix reported URLs
Online Tools
- WhyNoPadlock.com
- JitBit SSL Checker
Solution 10: Update CDN URLs
If using CDN:
- Log into CDN account
- Update origin URL to HTTPS
- Enable SSL on CDN
- Purge cache
Final mention: Please feel free to contact us for SSL migration help.
