Reputation: 892
Am working with a wordpress site, that use to have a lot heavy of png files on the uploads folder, (wp-content/uploads/year/month/filenames.png)
To reduce the disk usage on server I changed all the files to be .jpg, but, there are still a lot of references in the database (on the wp-post table in the guid column) pointing to the old .png files.
I would like to know if there is a way in mysql to find and replace all the text ".png" for ".jpg" in the column guid, but, only for those records that contains "wp-content/uploads/" (that would mean that am changing only the references to the files I changed and no others like maybe on wordpress themes)
Any solution is welcome, CLI commands, sql commands....
Upvotes: 1
Views: 920
Reputation: 17561
You could use an SQL query in adminer or phpmyadmin. But try Search RegEx, a good plugin to be able to search and replace (optionally with grep) through all posts, pages, excerpts, comments, titles and meta.
You can find and replace only in post/page content, do a trial run without replacing to see what is being replaced, and more. Your images are in post/page content, not in the GUID column.
Upvotes: 1