Making the WordPress OPML Export slightly more useful
2009.09.22 | #hacks #opml #php #wordpress
The WordPress OPML export tool is a fantastic utility, albeit rather clunky, for converting a WordPress blogroll into an XML file that can be read by many different link import utilities. However, one of the thing it lacks is the ability to export link descriptions along with the links. After a beverage of sloe gin and orange juice, I sat down at my computer and vowed to find a solution to this little hiccup. Thankfully the solution was mind-numbingly easy. Check this out:
If you’re at all PHP-inclined, then this will be a snap. In your WordPress folder, open up the wp-links-opml.php file in a text exitor of your choice. At line 54 (or thereabouts), there should be text that reads:
Well, right after the text
echo $bookmark->link_updated; ?>"and before the text
/>, add the following text:
What this does is add your all-important descriptions to the OPML file when it exports. Yay! Now you don''t have to manually add all the descriptions when you transfer your blogroll to another WordPress install.
Now if only I could figure out how to make the OPML import utility recognize and automatically generate categories in WordPress from the OPML file. But I''ll save that for another beverage.
Here's the code if you'd like to simply copy it and swap it out with your existing
/wordpress/wp-links-opml.php file. Just save it as