[wp-trac] [WordPress Trac] #9004: More filtering in get_terms() and wp_generate_tag_cloud()

WordPress Trac wp-trac at lists.automattic.com
Fri Jan 30 23:42:14 GMT 2009


#9004: More filtering in get_terms() and wp_generate_tag_cloud()
-------------------------+--------------------------------------------------
 Reporter:  jhodgdon     |       Owner:  ryan                       
     Type:  enhancement  |      Status:  new                        
 Priority:  normal       |   Milestone:  2.7.1                      
Component:  Taxonomy     |     Version:  2.7                        
 Severity:  normal       |    Keywords:  taxonomy, filter, has-patch
-------------------------+--------------------------------------------------
 I maintain a plugin that enables WordPress to switch languages at the
 click of a link.

 One issue that my users have is that lists of categories and tags that are
 supposed to be sorted by name end up not in alphabetical order if you
 switch languages. The reason for this is that the term name field contains
 something like this:
    {{{[lang_en]book[/lang_en][lang_es]libro[/lang_es]}}}
 (the language mumbo-jumbo and the non-current language info is filtered
 out upon display). While this tag would belong in letter "B" (book) if you
 are reading in English, if you switch to Spanish, it should be in "L"
 (libro), and obviously sorting by the term name field is not going to get
 that right.

 I looked into resolving this issue, and I was able to fix the sorting by
 adding a couple of new filters in get_terms() in wp-includes/taxonomy.php,
 and one in wp_generate_tag_cloud() in wp-includes/category-template.php
 (see patch I am about to add to this ticket).

 I've tested the added filters patch against both 2.7 (I added the new
 filter lines manually, actually, not sure if the patch will apply) and
 2.8-bleeding [10469] (the patch is against this version). I don't think it
 would do / could do / does anything bad, and it did allow me to add a few
 lines to my plugin and get everything sorted correctly. There's no
 straightforward way to get the sort working without this patch, aside from
 completely copying those two functions (and many others that depend on
 them) into the plugin, which would be a royal pain and difficult to
 maintain as well.

 So I'd appreciate it if you could add this in 2.7.1, or barring that, 2.8
 would be OK. I even added to the doc headers. :)

-- 
Ticket URL: <http://trac.wordpress.org/ticket/9004>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list