WordPress Blog

Nice Trick to Clean Old Entries

Posted October 29, 2003 by Matt. Filed under Development.

Mike has posted a great SQL trick to the forums. Old versions of b2 would naïvely enter break tags (<br />) into the database, often breaking block-level code posted or just making formatting awkward. Now that WordPress has the autop function to intelligently add line breaks what do you do about all of your legacy b2 content? Mike (who has entered his sixth month of not smoking, congrats!) offers this quick query:

UPDATE wp_posts SET post_content = REPLACE(post_content, '<br />', '');

Of course you should always backup your database before doing such an operation.

1 Ping

RSS feed for comments on this post. TrackBack URI

  1. Don’t forget to run it on wp_comments too.

    Comment from mike on October 31, 2003

0.127