[wp-trac] [WordPress Trac] #9547: Taxonomy - interesting 'unused' term_order column in table term_relationships.

WordPress Trac wp-trac at lists.automattic.com
Wed Aug 1 10:55:26 UTC 2012


#9547: Taxonomy - interesting 'unused' term_order column in table
term_relationships.
-------------------------------------------------+-------------------------
 Reporter:  michelwppi                           |       Owner:  ryan
     Type:  feature request                      |      Status:  reopened
 Priority:  high                                 |   Milestone:  Future
Component:  Taxonomy                             |  Release
 Severity:  normal                               |     Version:  2.8
 Keywords:  taxonomy term_order relationships    |  Resolution:
  has-patch dev-feedback                         |
-------------------------------------------------+-------------------------

Comment (by westi):

 Replying to [comment:10 simonwheatley]:
 > I've created a patch which adds the ability to request terms ordered by
 ```term_order``` when using ```get_the_terms``` or
 ```get_the_term_list```. Points to note:
 >
 >  * I've added “simple” function arguments, rather than using an
 ```$args``` style array as a final parameter as this seems to be the
 pattern for things nearer template tags than API functions, happy to
 change the patch if this isn't the right approach.
 >  * This has affected the caching in ```get_the_terms``` in that it no
 longer simply uses the cache controlled by ```get_object_term_cache```,
 because this cache does not respect ordering. It is not currently possible
 to pull the terms from the cache and order in PHP within the
 ```get_the_terms``` function, as the ```term``` objects do not contain the
 ```term_order``` property, even if it was deemed appropriate to sort terms
 in PHP at this point. I'd argue that the cache will still fill, even if
 there's more keys in it, and when it's full the system is just as cached
 as it was before, i.e. we've still got the function covered by a cache.
 >
 >

 I've taken a quick look and it looks good.

 Do you fancy creating some unit tests for this new functionality too?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/9547#comment:12>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list