[wp-trac] [WordPress Trac] #15039: wp_list_categories wrong sorting by name

WordPress Trac wp-trac at lists.automattic.com
Sat Jan 15 03:01:01 UTC 2011


#15039: wp_list_categories wrong sorting by name
-------------------------------------------------+-------------------------
 Reporter:  o----o                               |       Owner:
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Taxonomy                             |  Review
 Severity:  normal                               |     Version:  3.0.1
 Keywords:  wp_list_categorie, taxonomy, depth,  |  Resolution:  invalid
  sort,name                                      |
-------------------------------------------------+-------------------------
Changes (by mdawaffe):

 * status:  new => closed
 * resolution:   => invalid


Old description:

> look at this
> [http://test.artycok.tv/lang/cs-cz/places]
>
> the yellow table(on the linked page) 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
>
> .[[BR]]
>
> Všetaty u Mělníka[[BR]]
>
> Chorvatsko[[BR]]
>
> Velika Gorica[[BR]]
>
> Itálie[[BR]]
>
> Benátky[[BR]]
>
> .[[BR]]
>

> 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?

New description:

 look at this
 [http://test.artycok.tv/lang/cs-cz/places]

 the yellow table(on the linked page) 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

 .[[BR]]

 Všetaty u Mělníka[[BR]]

 Chorvatsko[[BR]]

 Velika Gorica[[BR]]

 Itálie[[BR]]

 Benátky[[BR]]

 .[[BR]]


 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?

--

Comment:

 This behavior is intentional (if a little confusing).  Use hierarchical =>
 false to get the order you expect.

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


More information about the wp-trac mailing list