mysql – Need SQL query to find&replace image URL


During a website move the wp-config.php file was replaced (by the host) to connect to the new database, and a directive I had in my old version (that specified a root folder for all images instead of the WP default ‘uploads’ folder) did not make it into the new wp-config.php file.

By the time I noticed it, we had a lot of content added with the images now in the /uploads folder.

I copied all the images now in /wp-content/uploads to /images, but I need a SQL query to cull thru all of the content and find&replace any image URLs that point to the /wp-content/uploads folder.

I am getting more proficient with PHP every day but still very weak with SQL, hoping someone can help me – I don’t mind adding a temporary plugin to do search & replace, but it seems like it should be simple to accomplish without a plugin. I do have access to phpMyAdmin and am always super-careful when I use it, backing up my database always before making changes.

Trisha 5 months 2022-09-12T12:56:43-05:00 0 Answers 0 views 0

Leave an answer