Written late in the morning in English • Tags: ,

Storing links in a database is an excellent idea. Storing links in multiple databases is not. To avoid having links all over the place to manage, I wrote wp-links.php for accessing the links table in the WordPress database. The idea is to be able to get lists of links as a “standalone” feature on pages that are not using WordPress, while still being able to manage the links through WordPress as well as use the links on the journal pages.

Some of the link categories in my database are used for navigation or in similar “single purpose” ways. I didn’t want these repeated in the “list all links” displays, so I amended the database schema to allow exclusion of categories from “all:” :

ALTER TABLE wp_linkcategories ADD list_in_all ENUM(‘Y’, ‘N’) DEFAULT ‘Y’ NOT NULL;

I modified wp-includes/links.php to take the new field into account as well. Before I can produce a patch I’ll have to modify the admin functions, too. (I don’t think “use phpMyAdmin” is a good general approach.)

To use wp-links.php from your own code, try something like this:

require ‘wp-links.php’; $wpl = new WPLinks(‘wpdb’,’localhost’,’myusername’,’secret’); echo ‘


This should work well with existing WordPress stylesheets.

1 comment

  • 1

    ned about FeedCreator, which is a great package for quickly creating feeds. So I enhanced wp-links to support feeds. However, I was to be disappointed — the links are in Firefox now […]

    Export WordPress links as XBEL - Kimmo Suominen — 27.11.04 @ 1:41

Sorry, commenting is not available for this post.