Nice Trick to Clean Old Entries


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.


%d bloggers like this: