Removing Target Attributes from Wordpress Links

For years, I’ve always added the target attribute to links going off-site. And for a while less, I’ve wished that I hadn’t – I believe that where a link opens should be left up to the user – but never had the motivation to stop or, more importantly, go back and edit all the old links.

Till now.

Instead of the Transitional doctype, I want to validate my pages with XHTML 1.0 Strict, in which the target attribute is deprecated. Google had the answer, in the form of Lorelle’s guide on search and replacing in WP databases. It’s quite simple, even for one with database-fu as weak as mine. Just login to your database via phpMyAdmin, hit the SQL button on the upper left and enter your query.

Lorelle’s sample is:

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

I had to change my table, which is still named from my b2/cafelog days, and so executed this:

UPDATE b2posts SET post_content = REPLACE (