Created
June 18, 2018 18:28
-
-
Save vyskoczilova/d50c4db8235128cebe38d2a411285607 to your computer and use it in GitHub Desktop.
WordPress DB: Images within legacy content
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
WordPress DB: Images within legacy content | |
source: https://css-tricks.com/moving-to-https-on-wordpress/ | |
author: Jason Witt (http://jawittdesigns.com/) | |
*/ | |
/* Quotes */ | |
UPDATE wp_posts | |
SET post_content = ( Replace (post_content, 'src="http://', 'src="//') ) | |
WHERE Instr(post_content, 'jpeg') > 0 | |
OR Instr(post_content, 'jpg') > 0 | |
OR Instr(post_content, 'gif') > 0 | |
OR Instr(post_content, 'png') > 0; | |
/* Single Quotes */ | |
UPDATE wp_posts | |
SET post_content = ( Replace (post_content, "src='http://", "src='//") ) | |
WHERE Instr(post_content, 'jpeg') > 0 | |
OR Instr(post_content, 'jpg') > 0 | |
OR Instr(post_content, 'gif') > 0 | |
OR Instr(post_content, 'png') > 0; | |
/* Custom fields */ | |
UPDATE wp_postmeta | |
SET meta_value=(REPLACE (meta_value, 'iframe src="http://','iframe src="//')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment