[wp-hackers] Taxonomy Schema Proposal

Peter Westwood peter.westwood at ftwr.co.uk
Mon Apr 16 08:20:24 GMT 2007


On Mon, April 16, 2007 9:05 am, Mark Jaquith wrote:
> On Apr 16, 2007, at 3:19 AM, Ryan Boren wrote:
>
>> Putting aside the rest of the debate, let's talk schema.  Here's a
>> proposed three table solution where we have terms (tags/categories),
>> taxonomies (link categories, post categories, post tags), and objects
>> (posts/pages and links).
>
> I've been thinking about this for the past couple of hours since you
> pitched it to me, and I've yet to find fault with it.  It appears to
> deliver everything Matt's been trying to shoehorn into our current
> structure, but has several huge advantages.  The queries are sane,
> there aren't a zillion foo_count columns, you can have completely
> different Link Category and Post Category trees, and (this is a BIG
> one), it is easily and cleanly extendible via plugins.
>
> Looking forward to the response on this.  Hope crowd from the other
> thread gives this a serious look.
>
> To all the people who want pages to be categorizable, with this
> schema, a plugin can do it *without adding any new tables* and
> *without screwing up existing taxonomies*.  That should get some
> people interested.
>

This new schema proposal looks really good.

I think we need to ensure we expose two levels of API.

A low level api that works directly with these individual tables should be
provided to allow plugins that extend it to add new taxonomies types
without needing to interact with the db directly.

e.g.
wp_add_term(term_name,term_slug)
wp_add_term_to_taxonomy(term_name,taxonomy,term_description,opt_parent)
wp_relate_term_to_object(term_name,taxonomy,object_id)


We can then write the tag/catgeory/link_category API on top of this low
level API so that they do not require any direct db access.


westi
-- 
Peter Westwood <peter.westwood at ftwr.co.uk>
http://blog.ftwr.co.uk


More information about the wp-hackers mailing list