More filtering in get_terms() and wp_generate_tag_cloud()
|Reported by:||jhodgdon||Owned by:||ryan|
|Component:||Taxonomy||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:
(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  (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. :)