Chip's Tips for Developers

Contains coding, but not narcotic.

Automatically saving del.icio.us tags as WordPress tags

May 23rd, 2008 4:59:36 pm pst by Sterling Camden

Over on Chip’s Quips, I use the “daily blog posting” feature of del.icio.us to post links on my blog.  These posts automatically contain links to each of the del.icio.us tags that I assigned to each link.  But I also use tags in WordPress, so I wanted to have a way to combine these taxonomies (that’s a megalellenicologism for classification systems) automagically.

Hence and forthwith, I present the Taglicious plugin for WordPress (not to be confused with the taga.licio.us plugin for WordPress), which you can download below.  Whenever a post or page is saved, the content is scanned for any del.icio.us tags, and the corresponding WordPress tag is added to the post if it doesn’t already exist.  There’s also a management page in the admin panel (Manage/Taglicious) that contains a single button to update all existing posts and pages.

The regex for detecting del.icio.us tags bears some discussion.  It looks like this:

|<a href="http://del.icio.us/(\w*/)+([^"#]*)|

(using | as the delimiter to avoid having to escape /).

We look first for a link to the del.icio.us site, followed by one or more word-like URL “folders”, followed by anything up to but not including an end-quote (terminating the link) or # (which is used for specifying a starting date, etc.).  This means that any del.icio.us link will get translated into a tag, even if it is someone else’s link.  So be warned.

UPDATE (8/3/2008): Changed the URL match from del.icio.us to delicious.com.

Posted in PHP, Web, WordPress | 2 Comments » RSS 2.0 | Sphere it!

2 Responses to “Automatically saving del.icio.us tags as WordPress tags”

  1. [...] Automatically saving del.icio.us tags as WordPress tags — Chip’s Tips for Developers Naturally the tags I’m putting on this right now will become WordPress tags, too. Meta! (tags: tags tagging taxonomy wordpress php regex plugins) Tags: communication, consulting, language, linklove, php, plugins, regex, tagging, tags, taxonomy, wordpress [...]

  2. [...] just updated the Taglicious plugin for WordPress to account for a change in the URL for links to delicious [...]

Leave a Reply

Better Tag Cloud