How To Hack The WordPress Blogroll Importer To Recognize Categories From Your Feed Reader
Do you let your WordPress blogroll go stale because importing and recategorizing hundreds of your current reads is too much of a chore? I do. Although WordPress will import an OPML file of all my feeds, the importer is only capable of importing my links into a single category. If you’ve ever used this function to import a large number of links spread over several categories, you know that having to manually move each individual link to the correct category is enough of a chore that it’s easier to let your links go stale.
Yesterday, I spent the entire day working on the issue that stood between me and blogroll full of fresh, categorized links. While I know that it’s bad form to edit core WordPress files, the result of my effort is a hacked version of link-import.php that makes WordPress (v. 2.3.3) recognize categories when importing an OPML file. I tested it with a few variations exported from both Google Reader and Thunderbird, and it seems to work pretty well.
What This Hack Will Do
- If you only have one category of links in your feed reader, everything should work the same as it did before.
- If you keep your feeds in multiple folders in your feed reader, the importer will check to see if each folder name is an existing category in the WordPress Links Manager. If it is, all the links from that folder get imported into the corresponding category. If there is no identically named link category, the links get dropped in the default category.
- When it’s finished, the importer notifies you of which folder names were not found so you can either create the missing categories, or check your spelling.
What This Hack Will Not Do:
- Anything secretive or nefarious. That is not my thing.
- It will not create new categories based on the folders from your feed reader automatically, because I thought that it would be safer to keep control over category creation as a manual process.
- It does not correct bad spellres. The category / folder match is case and space sensitive.
- It doesn’t handle anything beyond one level of folders. If you break down your feeds into more than one level of folders, the importer isn’t going to recognize them.
- It won’t hang around after you upgrade WordPress. This is a hack and not an official WordPress file, so it will get overwritten the next time you upgrade.
- It will not give you nunchuck or bow hunting skills, nor make you more attractive to the opposite sex.
How To Use This Hack:
- Download and unzip the hacked link-import.php
- Go to
[WordPress install folder]\wp-admin\ - Rename
link-import.phptolink-import.old - Upload the new
link-import.phpinto the directory.
How to Remove This Hack:
- Go to
[WordPress install folder]\wp-admin\ - Delete
link-import.php - Rename
link-import.oldtolink-import.php
How to Import Your Blogroll Into WordPress
- Export your list of feeds from your favorite feed reader to an OPML file.
- Go to Blogroll / Import Links in your WordPress admin panel.
- Input the location of your OPML file into the input box.
- Select a category from the dropdown menu to use as a default category. You may want to create a category called “uncategorized” to catch the missed links.
- Click the Import OPML File button.
- Check the results for any corrections that need to be made to your OPML file and re-import, if necessary.
If you have any suggestions or notice any bugs with the file, leave a comment and I’ll see what I can do to address them.
Share, Bookmark, or E-Mail This Article
March 25th, 2008 at 11:58 am
May I know $names used on Line 110 is used for? Where it was created or assigned value?