Archive · March 25, 2015

Wordpress MySQL Find and Replace Text String in all Posts / Pages using PHPMyAdmin

So you need to replace text in your wordpress Posts / Pages. Open up PHPMyAdmin and enter this SQL query. First: Export your wp_posts table so you have a backup if this messes stuff up. Always back up your DB before running MySQL commands. SQL: update wp_posts set post_content = replace(post_content, 'removeText', 'replaceText') where instr(post_content, 'removeText') > 0; Voila! Your site content is changed! In my example, some yahoo edited a ton of inline css and added a color I needed to replace. I replace 0000ff with 5382c2. update wp_posts set post_content = replace(post_content, '0000ff', '5382c2') where instr(post_content, '0000ff') > 0; mysql-wordpress-replace-text