Batch replace string in wordpress table

Today I needed to replace LOTS of values inside a wordpress database, especially the meta_value in the wp_postmeta table. This solution will allow you to only replace values with a specified meta_key. It is very usefoul if you are using (like me) some “custom values” plugin in your posts.
UPDATE `YOUR_WORDPRESS_DATABASE`.`wp_postmeta` SET `meta_value` = REPLACE(`meta_value`,"OLD_STRING","NEW_STRING") WHERE `wp_postmeta`.`meta_key` = "YOUR_META_KEY";
This solution is also much better than downloading the database and using a text editor because you can specify the meta_key to be selected!

2 Responses to Batch replace string in wordpress table

  1. Pingback: Tweets that mention Batch replace string in wordpress table | Some Little News -- Topsy.com

  2. Pingback: Blog

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Home
Twitter Facebook Flickr Vimeo About me Email me