[wp-hackers] tags order

Austin Matzko if.website at gmail.com
Mon Mar 9 22:01:23 GMT 2009


On Mon, Mar 9, 2009 at 1:27 PM, Jake McMurchie
<jake.mcmurchie at googlemail.com> wrote:
> Does anyone know of any plugins that allow tags to be ordered?
>
> The hard-wired tag order is alphabetical and I have a client who wants the
> order in which they are typed it to be preserved.

I'm assuming that the tag ID will correspond to the order in which the
tag was typed, so you can request tags ordered by ID.  Unfortunately,
although wp_tag_cloud() accepts an orderby argument, it overrides it.
So you'll have to use a callback function on the "get_tags" function,
as in the following example, to do what you want:

add_filter('get_tags', create_function('$t', 'return get_terms(
"post_tag", array("orderby" => "id") );'));
wp_tag_cloud();


More information about the wp-hackers mailing list