Update: Please see this recent post regarding this WordPress function.
I wanted to help out a friend earlier tonight by importing a blogroll from a hobby site (running the latest version of WordPress) to hers (also running the latest version of WordPress). For the life of me, I could have sworn that WordPress had the ability to export to OPML.
Boy was I wrong! Not only did WordPress NOT have the ability to export blogrolls to OPML, it had absolutely no blogroll exporting capabilities at ALL.
I got the bright idea that maybe I could just export directly from phpMyAdmin. After looking at the structure of my WP tables, I decided that I didn’t want to sit and have to go through the exported data and re-structure by hand.
This was quickly becoming a lot more complicated than I needed. “OK,” I thought to myself, “No problem, I’ll just find a WordPress plugin to do this for me, no biggie.”
Google to the rescue! Or not …
After about an hour of searching and finding absolutely nothing — or rather, nothing helpful — on the topic in the WordPress support forums, in the WordPress Codex, or on the web in general, I decided to broaden my search from exporting blogrolls in WordPress into OPML format to just “export blogroll in WordPress.”
The first and pretty much ONLY helpful hit was for a plugin to export a WordPress blogroll for del.icio.us. It wasn’t exactly what I needed, but after looking at the plugin’s code, I decided that the quickest way to get to where I wanted to be was to hack up that plugin.
It’s pretty simple and I’m surprised that there aren’t more out there like it. It has one configuration option: whether to export all links ‘as is’ or export by a specific category or public/private links. Of course, the last version of WordPress that it supported (listed on the website) is WP 2.2, and the links/categories structure has been redone recently so exporting by category was not an option (and didn’t work at all).
I would have to re-categorize by hand once they were imported — not the solution I wanted, but by this point I would be happy not to have to add each link by hand!
Put on your coding hat
I had to re-design the plugin’s output format, as del.icio.us’ format was nowhere near OPML-friendly (and by this point I had wasted over 2 hours on this crap). So, this is what I did:
I made sure that the export option was set to export all links:
/* ********************************* */
/* [ THIS IS THE VARIABLE TO EDIT: ] */
/* ********************************* */$option = “”;
Then, in the “DO NOT EDIT BEYOND THIS POINT” section, I modified the export_blogroll_admin() function to this. (could not post code in here, click the link to view .txt file!)
Afterthoughts, FYI…
I snagged the OPML formatting from one of my blogrolls on Blogrolling.com. (If you login, go to “Get Code”.) The ‘lastmod’ time is of course VERY off, but it doesn’t matter once it’s imported into WordPress.
Of course, any URLs with ampersands in them WILL NOT import, so remember to convert those &’s to &
amp
;
— also, look out for any link titles with odd characters in them, those will not import either.
It’s more complicated than it needs to be, and honestly I’m surprised that this capability is not already available in WordPress. While I had to go a round-abouts way to do this, it’s a bit overkill IMO. Think: Fat guy in a little coat meets midget in plus size clothing. (RIP Chris Farley)
Mara Alexander
All my WordPress skinning R belong 2 U :)
Now…if you only did Joomla….*wistful sigh*
Yes, I hace crossed over to the darkside, at a client’s request. Money is money.
Beth
So…are you going to release a new plugin? :smile:
Beth’s last blog post: hillary clinton’s silly irish peace claims
Nicki
Mara, if you are in need of skins, I know of a place … email me.
Beth: LOL, I just might … when/if time allows for testing and documentation. ;)
Beth
Yeah, testing and documentation…bleh.
Well, I’ll help with testing, if you want a second set of eyes doing testing, if you get around to doing a plugin! :grin:
Beth’s last blog post: Join McCain Blogs, and get in on the carnival
Nicki
Thanks, Beth, you’re a doll! ;)
» Enlaces en Diigo 05/08/2008 | DigiZen: Un blogfesor aprendiendo
[…] Export blogroll for WordPress ยป The Birthplace of the Process of Illogical Logic […]
exporting links / blogroll from wordpress | The World in a Square :: Kimberly Lightholder
[…] it yields little results. There is a plugin for exporting your blogroll to de.licio.us, and an interesting post by someone who hacked the plugin to be able to simply export the links in a standard format, but most of the […]
Guru
Nice hack..Why Don’t you release this hack as new plugin ? :wink:
washwords
ta da! maybe you’ve long since figured this out but here was the magic bullet for me…. thanks wolfie!
http://wolfshowl.com/2008/01/04/of-blogrolls-and-widgets/