• look at this
    https://test.artycok.tv/lang/cs-cz/places

    the yellow table shows the wp_list_categories list.
    Bold text are the arguments I run and the rest is the result.
    (here is a copy of the function)

    $sec_level_arg = array(
    'style' => 'none',
    'orderby' => 'name',
    'order' => 'ASC',
    'hide_empty' => '0',
    'depth' => '2',
    'taxonomy' => 'taxonomy',
    'echo' => '0',
    );
    echo wp_list_categories($sec_level_arg);

    If you look at the output closer you realize that it isn’t sorted by name. Here is the part of the output

    .
    .
    V?etaty u Mělníka
    Chorvatsko
    Velika Gorica
    Itálie
    Benátky
    .
    .

    as you can see it isn’t alphabetical in any way.

    It seams to me that this problem occurs only when I go deeper then 'depth' => '1',
    The depth one seams to be OK, but 2, 3 are mixed in this weird way.
    Plus, might be that the problem show up only for taxonomies(I have no proof if it does same thing for categories as well), but that’s only my guess. If that’s the truth then there is something wrong in WP core.

    any suggestions?

Viewing 5 replies - 1 through 5 (of 5 total)
  • I have the same problem, using 3.1.2 and this code:

    wp_list_categories('orderby=name&order=ASC&show_count=0&title_li=&hide_empty=1&depth=1&exclude=1')

    The categories aren’t loaded by name at all. If I use ID instead, it works ok, but ordering by name fails!

    Thread Starter 2046

    (@o-o)

    check if you don’t use any language plugin, which was my problem.

    example:
    Curich|Zurich
    this city name took always the “C” position in the list, because sorting function runs before the language plugin.
    If the plugin parse the item before WP core sorting function all will be OK, but that isn’t the case.

    hope it helps

    I don’t use a language plugin and the order remains the same, namely the order in which I added the categories, thus by ID. I have three levels of categories and I only want to show the first level of parents in alphabetical order. How hard can it be? ??

    I reduced the code to this

    <?php wp_list_categories('show_count=0&title_li=&depth=1&exclude=1');

    and it still doesn’t order the categories by name…

    Found the cause…
    I use the Import Category plugin and this breaks the ordering.
    I already contacted the author of this otherwise great plugin.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘wp_list_categories wrong sorting by name’ is closed to new replies.