I'm having a problem with MySQL. When I run the code below, via phpmyadmin:
UPDATE wp_posts
SET post_content = REPLACE
(
post_content,
'31.media.tumblr.com/',
'41.media.tumblr.com/'
)
WHERE post_content LIKE '%31.media.tumblr.com/%'
AND post_content NOT LIKE '%.gif%';
It returns:
9000 rows affected
If I make a search, it shows that it replaced all the needed things successfully. But if I go and hit the 'EDIT' option in phpmyadmin on one of the rows inside the post_content
column, no changes are done inside it; everything stays the same.
What might be the reason?
For me there's something wrong with the code above. Maybe it returns NULL
or something and stops the update. If I remove this part:
AND post_content NOT LIKE '%.gif%';
…it does work properly.
The database is a default WordPress one:
Example of data inside post_content
:
<p>some text</p>
<img src="http://31.media.tumblr.com/eet1r5co8so1/tumblr_mzlt6zqeet1r5co8so1.gif" alt="" />
<img src="http://11.media.tumblr.com/L4B1q/tumblr_ml5i2cGL4B1qz4fjqo1.gif" alt="" />
other text
<img src="http://51.media.tumblr.com/n42sryL4JG1rda3bfo1/tumblr_n42sryL4JG1rda3bfo1.jpg" alt="" />
<img src="http://31.media.tumblr.com/eet1r5co8so1/tumblr_noui3gHzxp1qfvouao1_1280.jpg" alt="" />
some other text
...
Best Answer
I did the same as you did and it worked.
Are not you missing something?