WordPress – find and replace

I got some wordpress blogs (20+) running on some servers, and from time to time, i need to make some FIND&REPLACE on my posts…

This is the simple way! Directly on mysql.

UPDATE wp_posts SET post_content = REPLACE (  
post_content,  
'Item to replace here',  
'Replacement text here');

Please note the for security reasons the prefix wp_ is diferent… if you play by the rules you will need to see witch is is… wp-config.php has it.

mysql> UPDATE wpspt_posts SET post_content = REPLACE (
-> post_content,
-> 'static.mycdn.com/banners/',
-> 'static.mycdn.com/bnnrs/');
Query OK, 1477 rows affected (0.42 sec)
Rows matched: 10795 Changed: 1477 Warnings: 0

This is a small hack to ABP – Ad Blocker Plus…
Horray!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.