[wp-trac] Re: [WordPress Trac] #4189: Taxonomy Schema and API

WordPress Trac wp-trac at lists.automattic.com
Wed May 2 00:27:12 GMT 2007


#4189: Taxonomy Schema and API
-------------------------------------------+--------------------------------
 Reporter:  ryan                           |        Owner:  anonymous
     Type:  defect                         |       Status:  new      
 Priority:  normal                         |    Milestone:  2.3      
Component:  General                        |      Version:  2.2      
 Severity:  normal                         |   Resolution:           
 Keywords:  term taxonomy tags categories  |  
-------------------------------------------+--------------------------------
Comment (by majelbstoat):

 There was lots of discussion about the proposed schema on the hackers
 list, linked in the description of this ticket.

 The slug and term_name being different sizes is a typo.  Personally, I
 would prefer shorter fields as multilingual plugins are used by a minority
 of users, and having size 200 is pretty inefficient for the vast majority
 of people.  I would certainly by -1 for a text field.  Plugins that need
 to extend the size of a field can do so easily by making an ALTER TABLE
 statement when they are activated.

 The API as in the file is obviously nowhere near complete.  Unfortunately,
 I'm a bit under the weather, so it's been a little while since I worked on
 it.  The retrieval functions aren't written for example, but and example
 might be something like:

 {{{$wp_taxonomy->get_object_terms(3, array('post_category',
 'post_tag'));}}}

 Returning all the categories and tags for the specified post.  The first
 argument may also be an array to retrieve whole subsets of taxonomy in one
 go.  The aim is to provide functions for every interaction with the
 database.  Setting the categories or tags for a post is pretty easy, and
 is explained above:

 {{{$wp_taxonomy->add_term_relationship(array('cities', 'vacation',
 'Japan'), 3, array('post_category', 'post_tag'));}}}

 Adds post 3 to categories, 'cities', 'vacation' and 'Japan', as well as
 tagging them with the same.  Obviously, the arguments can be changed to
 add link_categories or your_taxonomy or whatever.

 The proposal isn't difficult to understand, it's just very different from
 what is there now.  What code is there is extensively commented and I'd
 encourage anyone else who works on this to continue to do the same.  Terms
 are stored in the terms table and shared by all taxonomies.  Terms are
 bound to taxonomies in the terms_taxonomies table, where we also store
 counts and hierarchical information.  Term taxonomies and objects are
 bound in the term relationships table.  Again, though, the idea is that
 plugin developers won't need to fully understand the structure to add new
 taxonomy information.  (I can understand why you'd want to though!).

 If you can outline the specific functionality that you'd like to see, we
 can make sure it goes in to the API.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4189#comment:7>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list