May 03

How to do string replace using MySQL

Here is how you can do a quick replace of a particular word in your WordPress blog:

UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,‘color’, ‘colour’);

This replaces posts with the word ‘color’ and change it into ‘colour’. I was doing a whole lot of string replacements to replace URLs that are no longer valid.

Possibly related:

  1. How to perform routing in CakePHP 1.2
  2. How to select data with month and year in MySQL
  3. How to read RSS feed with PHP
  4. Blogging is addictive again

No comments yet. Leave yours here.


WordPress powered and Django inspired.
Love and elephants come after.
RSS: Posts and comments.