Nice Trick to Clean Old Entries

Posted October 29, 2003 by Matt Mullenweg. 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.

No Pings

RSS feed for comments on this post.

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

    Comment from mike on October 31, 2003

See Also:

Want to follow the code? There’s a development P2 blog and you can track active development in the Trac timeline that often has 20–30 updates per day.

Want to find an event near you? Check out the WordCamp schedule and find your local Meetup group!

For more WordPress news, check out the WordPress Planet or subscribe to the WP Briefing podcast.


Subscribe to WordPress News

Join 1,931,688 other subscribers


%d bloggers like this: