matty04
Member
Posted 2 years ago #
Hello -- I'm hoping there's a MySQL guru who can help me with this. I want to create a query that will look for a certain string in my posts, and change it. To be more specific, I'd like to search my posts for any occurrence of an image link where the url is "http://www.example1.com/..." and change it to "http://www.example2.com/...".
Is this possible? If someone can offer a MySQL query to do it (inside PHPMyAdmin preferably), or point me in the direction to figure it out, I'd be grateful! Thanks.
Will be much easier if you use this plugin.
http://wordpress.org/extend/plugins/search-and-replace/
Which essentially runs the kind of query you need "search and replace"..
matty04
Member
Posted 2 years ago #
Thank you t31os_! Worked like a charm.
You're welcome, i'll mark this resolved.. :)
i have a sneaking suspicion defining the url in wp-config will do the same thing, unless you don't want to update other urls, i think i saw it happen when i was testing migrations, running a migration soon so will see if it works
Yes updating the URL will work, but if you forget to do that prior to moving a site, then you'll need to use the above plugin to fix the wrongly pointed URLs.. (alternative would be to write your own query to search and replace, though essentially it would look alot like the one in the plugin).
It's a very easy to use plugin, the procedure doesn't take long either, so i'd imagine it's a very handy tool if you're dealing with migrations on a regular basis (for those times you simply forget the little details).