1# UPDATE `wp_posts` SET `post_content` = REPLACE(post_content, '', '')
2
3# Update self-hosted embeds (images, iframes, scripts, etc.)
4UPDATE `wp_posts` SET `post_content` = REPLACE(post_content, 'http://yoursite.com', 'https://yoursite.com');
5UPDATE `wp_posts` SET `post_content` = REPLACE(post_content, 'http://www.yoursite.com', 'https://www.yoursite.com');
6
7# Update internal pingbacks
8UPDATE `wp_comments` SET `comment_author_url` = REPLACE(comment_author_url, 'http://yoursite.com', 'https://yoursite.com');
9UPDATE `wp_comments` SET `comment_author_url` = REPLACE(comment_author_url, 'http://www.yoursite.com', 'https://www.yoursite.com');
10
11# Update YouTube embeds
12UPDATE `wp_posts` SET `post_content` = REPLACE(post_content, 'http://www.youtube.com', 'https://www.youtube.com');
13UPDATE `wp_posts` SET `post_content` = REPLACE(post_content, 'http://img.youtube.com', 'https://img.youtube.com');
14
15# Update Vimeo embeds
16UPDATE `wp_posts` SET `post_content` = REPLACE(post_content, 'http://player.vimeo.com/', 'https://player.vimeo.com/');
17
18# Update Slideshare embeds
19UPDATE `wp_posts` SET `post_content` = REPLACE(post_content, 'http://www.slideshare.net', 'https://www.slideshare.net');
http
(insecure) endpoints (links).post_content
column of the wp_posts
tableREPLACE
function and change http
with https
Mixed Content:
warnings..)1SELECT * FROM `wp_posts` where `post_content` LIKE "%http://%"
While you might be tempted to just update ALL links in posts to https
in one go with the above command, this can cause issues. Not all sites (unfortunately) have shifted to https
yet and if you update all posts links, you’ll get plenty of broken ones. Best approach is to update the links for known sites that you know for a fact use https
(Sites like YouTube, Vimeo, Twitter as well your own site)
This means anything in the wp-content/uploads
directory
1# Update Media links
2UPDATE `wp_posts` SET `post_content`=REPLACE(post_content, 'http://amiranzur.com/wp-content/uploads', 'https://amiranzur.com/wp-content/uploads')
1# Update YouTube links
2UPDATE `wp_posts` SET `post_content`=REPLACE(post_content, 'http://youtube.com/', 'https://youtube.com/')
3
4# Update Vimeo links
5UPDATE `wp_posts` SET `post_content`=REPLACE(post_content, 'http://player.vimeo.com/', 'https://player.vimeo.com/')