Sometimes, we need to find and replace certain strings or pieces of data in MySQL on the fly, for example if we’ve changed a Top Level domain (TLD) and want to update a bunch of links all in one go. For those times, the following command can be issued:
1 update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]');
This can be used, for example, to update strings contained in WordPress posts, such as a lot of links which you’d like to send to another domain. If you’d like specific code examples for doing this, please leave a public comment below, and I’ll update with this info.
- WordPress – Using MySQL to Update Specific Custom Fields
- Transport HTTPS traffic to HTTP with .htaccess
- WordPress Plugins Auto Update Doesn’t Work – What to Do?
- How to Get ValueChecker Working With WordPress
- WordPress Tip: How To Use Shortcodes in Widgets