Column text replace

Here I used wp_postmeta table and meta_value column in WordPress (MySQL database)

This could be used for any other table and column. I checked this for MySQL and similar functions should exist in other databases also.

SELECT * FROM `wp_postmeta` where `meta_value` LIKE '%unwanted_text%'

The Update looks like this:

UPDATE `wp_postmeta`

 SET `meta_value` = replace(`meta_value`, 'unwanted_text', 'wanted_text')

tags: & category: -