[wp-hackers] Reference TermId or TermTaxonomyId for category
plugin?
Jennifer Hodgdon
yahgrp at poplarware.com
Sun Feb 8 05:34:11 GMT 2009
I'm not sure that "wordpress always references the term_id". For
instance, the term_relationships table (which associates categories
and tags with particular posts) uses term_taxonomy_id as its key,
because a given term could be both a category and a tag, and you want
to be able to associate them independently with a post.
However, term_id is the only way to look up the term information (such
as the slug, term name, etc. -- stored in the terms table), so many
functions do use term_id.
So I think you could go either way... If you are only concerned with
metadata for post categories (as opposed to tags or link categories),
you can probably get away with using term_id. If you are possibly in
the future going to want to store different metadata for categories
and tags that might happen to share the same terms table record (i.e.
same name, slug, etc. and hence the same term_id), then key off
term_taxonomy_id.
--Jennifer
Dan Fellars wrote:
> Hi - I am writing a plugin that creates metadata for categories (using
> the c2c custom fields for anything plugin as the core).
>
> Im debating which table I should reference back to - the terms or
> term_taxonomy table?
>
> To me it makes sense to reference the term_taxonomy_id in the
> term_taxonomy table since then you know you are getting the category
> taxonomy.
>
> But it seems that wordpress always references the term_id (i.e. the
> cat_ID in categories.php refers to the term_id).
--
Jennifer Hodgdon * Poplar ProductivityWare
www.poplarware.com
Drupal/WordPress Sites, Themes, Modules/Plugins
Custom Web Programming, Web Databases
PHP, Perl, MySQL, JavaScript, XML, AJAX
More information about the wp-hackers
mailing list