How to Fix WordPress Mixed Content Warnings: Complete HTTPS Padlock Fix
Google AdSense In-Article Display Placement
Publisher ID: ca-pub-XXXXXXXXXXXXXXXX (Configured in config.php)Even after installing an SSL certificate, browsers show an insecure exclamation mark instead of a padlock if post content, custom CSS, or header logos load via unencrypted "http://" links.
1) In WP-Admin -> Settings -> General, ensure both "WordPress Address (URL)" and "Site Address (URL)" start with https://. 2) Install the free plugin "Better Search Replace" and replace "http://yourdomain.com" with "https://yourdomain.com" across all tables. 3) Alternatively, add the Content-Security-Policy header "upgrade-insecure-requests;" to .htaccess.
📋 Guide Table of Contents
1. Problem Diagnosis & Symptoms
Modern browsers block insecure scripts automatically and degrade the security indicators on pages with mixed images.
2. Primary Root Causes
- Cause: Hardcoded http:// image links created prior to SSL installation.
3. Step-by-Step Diagnostic Fixes
Add CSP Upgrade Insecure Requests to .htaccess
Instruct browsers to automatically fetch insecure assets over HTTPS:
<IfModule mod_headers.c>
Header always set Content-Security-Policy "upgrade-insecure-requests;"
</IfModule>
4. How to Verify the Resolution
- Open Chrome DevTools Console; confirm zero Mixed Content warnings.
5. Diagnostic Troubleshooting Matrix
| Symptom Observed | Root Cause | Recommended Action |
|---|---|---|
| Padlock missing only on specific blog posts | Images inserted into post content using legacy http:// URLs | Run search and replace across wp_posts table |
6. Critical Mistakes to Avoid
- ❌ Never edit serialized database strings with raw SQL REPLACE without a serialization-safe tool.
7. Frequently Asked Questions
❓ Why does raw SQL REPLACE break WordPress theme widgets?
WordPress stores widget settings as serialized PHP arrays where string length is tracked. Raw SQL changes string length without updating metadata, corrupting the array.
Official Technical References
Google AdSense In-Article Matched Content Unit