Mixed content warnings after changing site adress from HTTP to HTTPS

This is happening because WordPress saves URLs in content absolutely by default (meaning that it’s actually got your urls saved as http://example.com in the database). So to fix this you’ll want to run a search and replace in your database to fix those errors.

I like to use the plugin Better Search Replace because it has a nice feature to let you try out your search/replace as a dry run to test. There are lots of other search/replace methods, and you could also make the changes in PhpMyAdmin, but I’ll just put instructions for using the Better Search Replace plugin.

Assuming you are using Better Search Replace:

  1. BACK UP YOUR DATABASE! Always always always. Use whatever tool you want to do this (UpdraftPlus, or dump (NOT DROP) it from PhpMyAdmin or straight from MySQL are all options).
  2. Head to tools > Better Search Replace
  3. Add the non SSL version of your website to the search field http (eg. http://example.com) and the SSL version of your website to the replace field Search Replace Example 1
  4. Select the tables you want to update. Most likely all you’ll need is the wp_posts and wp_postmeta table but you can add them all if you like. Just know that it could take longer and time out depending on your server specs.Select your tables
  5. Do a dry run to make sure that it works Dry run
  6. If it works, then uncheck the dry run option and run it for real.
  7. Check your website to verify the errors have been fixed. If they have, awesome!

Note: Any time you search/replace there’s a chance you could cause massive problems to your website. Hence step one, back up your website. If something goes wrong, you have a way to restore your data.

Leave a Comment