Security

How to Fix Mixed Content Warnings in WordPress

Learn how to fix mixed content warnings in WordPress quickly. Eliminate insecure HTTP scripts and images to restore your SSL padlock and protect visitors.

Daniel ReissBy Daniel Reiss·November 5, 2026·How we test

What Causes Mixed Content and Why You Must Fix It

A mixed content warning occurs when your core webpage loads securely over HTTPS, but individual resources like images, stylesheets, fonts, or tracking scripts are requested over insecure HTTP. To fix mixed content in WordPress, you must locate these insecure references and rewrite them to use HTTPS protocols across your database and theme files, or enforce an automatic upgrade header at the web server level.

Browsers treat active mixed content such as JavaScript files and passive mixed content like embedded images differently, but both hurt your website credibility. Modern browsers like Chrome and Firefox actively block insecure scripts by default, breaking forms, sliders, and navigation menus. Passive assets often trigger a broken padlock icon or an explicit 'Not Secure' warning in the address bar, eroding consumer trust, inflating bounce rates, and diluting the SEO benefits of your SSL certificate.

Many site owners assume installing a free Let's Encrypt certificate automatically upgrades every internal link, but legacy database entries retain their original HTTP prefixes. Until you systematically replace these hardcoded strings or instruct the client browser to intercept and rewrite them, the browser will refuse to grant your site full secure status.

Method 1: Update Insecure URLs with a Search and Replace

The cleanest and most permanent way to eliminate mixed content is running a comprehensive search and replace directly across your WordPress database. When you migrate from HTTP to HTTPS, existing post content, custom fields, and widget settings continue pointing to absolute HTTP paths. Using a specialized tool like WP-CLI or the Better Search Replace plugin allows you to swap your legacy domain string for the secure equivalent in a single operation.

Before altering database records, always take a complete database backup through cPanel, phpMyAdmin, or your hosting control panel. When running the utility, search for 'http://yourdomain.com' and replace it with 'https://yourdomain.com', ensuring you do not use trailing slashes. Crucially, professional database replacement tools safely unpack PHP serialized data arrays found in WordPress option tables, preventing corrupted settings that standard SQL queries often cause.

Avoid using raw SQL commands like UPDATE wp_posts SET post_content inside phpMyAdmin unless you are confident no serialized strings exist in those fields. After executing a dry run to verify the number of affected cells, run the live update, purge your WordPress object cache, and reload your front-end pages in an incognito window to verify the padlock appears.

Method 2: Enforce Upgrades via Server Headers and .htaccess

If third-party embeds or legacy plugins inject external HTTP assets beyond your direct database control, you can force modern browsers to resolve them securely using the Content Security Policy upgrade-insecure-requests directive. This instruction tells the visitor's browser to seamlessly translate all HTTP requests to HTTPS before transmitting the network call, resolving warnings without altering historical database entries.

To deploy this directive on an Apache or LiteSpeed server, edit your root .htaccess file and insert the header rule near the top of the document. Add 'Header always set Content-Security-Policy "upgrade-insecure-requests;"' inside the mod_headers module block. Nginx users can achieve identical results by appending 'add_header Content-Security-Policy "upgrade-insecure-requests;";' to their server block configuration before reloading the web service.

While this server directive represents an exceptionally fast remedy, remember its critical limitation: it only works if the remote hosting server actually supports an HTTPS handshake. If an external supplier hosts an image exclusively over raw HTTP without SSL capabilities, the browser will block the asset entirely instead of serving it insecurely, leaving you with a broken asset placeholder.

Common Mixed Content Traps and How to Avoid Them

Hardcoded references inside custom theme templates, style.css files, and child theme functions bypass database search-and-replace scripts completely. Developers frequently hardcode protocol-relative or absolute HTTP paths to external Google Fonts, font icon libraries, or background image URLs within static stylesheets. Inspect your stylesheet files manually or use your browser DevTools Console tab to pinpoint the exact file paths triggering insecure asset warnings.

Page builders like Elementor, Beaver Builder, and Divi cache generated CSS files on the local filesystem rather than querying the database dynamically on every request. If you perform a database migration, these static CSS files continue serving the old HTTP URLs until you trigger a manual regeneration. Navigate to your respective page builder tools menu, clear the generated CSS cache, and flush your site-wide performance cache to refresh those asset paths.

Lastly, check your reverse proxy and CDN configurations if you use providers like Cloudflare. Setting your encryption mode to 'Flexible' rather than 'Full (Strict)' forces your origin server to communicate over unencrypted HTTP, generating persistent mixed content loops and stripping protocol headers before they hit the end user's browser.

Frequently asked

Questions readers ask about this topic

Why does my WordPress site still show 'Not Secure' after installing an SSL certificate?

Your site displays this warning because individual assets like images, scripts, or stylesheets are still loading over insecure HTTP connections, preventing the browser from granting full SSL validation.

Does the Really Simple SSL plugin permanently fix mixed content?

No, it fixes mixed content dynamically by rewriting URLs via output buffering before page delivery. While functional, it consumes additional PHP resources and does not alter the underlying insecure database values.

How can I find the specific files causing mixed content on a page?

Open your browser, press F12 to open Developer Tools, and click the Console tab. The browser will print yellow or red warning messages listing the exact HTTP URLs causing the security violation.

Can mixed content hurt my website's Google search rankings?

Yes. Mixed content breaks HTTPS validation, which is a recognized Google ranking factor, and can cause browsers to block essential layout styles and functional scripts that dictate Core Web Vitals performance.
Keep exploring · Security

Where to go next on Hostilo

Newsletter

One email a month. Hosting deals, new reviews, no fluff.

Related reading