[wp-hackers] Adding meta data to categories

Austin Matzko if.website at gmail.com
Fri Jan 9 00:40:03 GMT 2009


On Thu, Jan 8, 2009 at 5:18 PM, Mike Schinkel <mikeschinkel at gmail.com> wrote:
> SET @term_id:= 3;
> INSERT wp_terms (term_id,name,slug,term_group) VALUES (@term_id,'Category
> Tags','category-tags',0);
> INSERT wp_term_taxonomy term_id,taxonomy,parent,count) VALUES
> (@term_id,'category_tag',0,0);

There's no need to do direct MySQL queries.  WordPress's taxonomy
system has a very rich API.
See register_taxonomy(), wp_insert_term(), and wp_set_object_terms().

>   the term_taxonomy_id should be set
> to the term_id of the tag that you want to apply to this category.

Actually---and confusingly---term taxonomy ids and term ids are *not*
the same (sometimes they happen to be the same).


More information about the wp-hackers mailing list