WordPress mixed-content warning when changing to HTTPS
As we switched our wordpress to https, we encountered some mixed-content warning in the browsers.
https://support.mozilla.org/en-US/kb/how-does-content-isnt-secure-affect-my-safety?redirect=no
The reason is, that there are some links in the page, that refer to http instead of https. This often applies to image links.
An easy way to fix that, was to show the HTML source code in a browser and then identifying the ‘http://’ url with the search. You may find something like that:
<span id="line84"></span>.page-id-1234 #headerwrap {
<span id="line85"></span> background-image: url(http://www.datainmotion.de/...);
<span id="line86"></span> background-repeat: no-repeat
<span id="line87"></span>}
<span id="line88"></span>
You recognize the .page-id-1234. 1234 is the id of the post in the database. So, if you now look into the wordpress database, there is a table called wp_postmeta, where you can find the corresponding entry with:
SELECT * FROM wp_postmeta WHERE post_id = 1234 AND meta_value LIKE '%http://%';
You will find an entry with a certain meta_key like in this case Background_image
mysql> SELECT * FROM wp_postmeta WHERE post_id = 1234 AND meta_value LIKE '%http://%';<br />+---------+---------+------------------+------------------------------------+<br />| meta_id | post_id | meta_key | meta_value |<br />+---------+---------+------------------+------------------------------------+<br />| 321 | 1234 | background_image | http://www.datainmotion.de/bla.jpg |<br />+---------+---------+------------------+------------------------------------+<br />1 row in set (0.00 sec)
Now you can update the entry with:
UPDATE wp_postmeta SET meta_value = "https://www.datainmotion.de/bla.jpg" WHERE meta_id = 321;
That fixed the whole problem for me. I experienced, that it took a while until the changes are reflected to the browser. Maybe because of caching inside wordpress.
Please handle that with care and at your own risk.
Have fun!
by Ilenia Salvadori, Mark Hoffmann, Jürgen Albert