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:
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.
More Like This:
- WordPress – Using MySQL to Update Specific Custom Fields
- How to Get ValueChecker Working With WordPress
- WordPress Plugins Auto Update Doesn’t Work – What to Do?
- The Correct Way to Copy/Paste From Microsoft Word / OpenOffice Writer to WordPress
- Code Example – Premier League Top Goalscorer Odds Comparison