Load images and media over HTTPS on WordPress
Why it matters
http:// images, audio and video on an https page can be swapped or watched on the network, and browsers either upgrade them or mark the page as not fully secure. Switching them to https:// URLs removes the risk and the warning.
The fix
- Set WordPress Address and Site Address to https://, then replace old http links in the database with WP-CLI as below (back up and dry run first; run it for each host name the site used).
- Edit remaining third-party http:// image URLs in posts, widgets and page-builder settings, then clear caches.
bash
wp db export before-https.sql wp search-replace 'http://example.com' 'https://example.com' --skip-columns=guid --dry-run wp search-replace 'http://example.com' 'https://example.com' --skip-columns=guid
The examples use example.com. Replace it with your own domain.
Related
Scan your domain to see whether this applies to you.