I have list of terms which happens to be the Polish Alphabet.

Here's how I list these terms:

   $terms = get_terms("taxonomy", array('orderby' => 'title', 'hide_empty' => 0));
   foreach ( $terms as $term ) {
      echo "<li><a href='". get_term_link( $term->slug, $term->taxonomy ) ."'>" . $term->name . "</a></li>";
   } ?>  

Everything works like a charm excepting one thing - the letter that is supposed to be after "L" ("Ł") is always the last element o that list (so it's after "Ż", not "L"). Is there any way to fix it? I've been trying multiple WP versions including Polish builds.

Any ideas? I can always do two foreach loops for A-L and M-Ż and add that one between them, but would love to do that with more class.

1 Answer 1


You need to set the database collation to utf8_polish_ci in your wp-config.php to get correct sorting.

  • I set define('DB_COLLATE', 'utf8_polish_ci'); in wp-config.php but it doesn't seem to help, the letter is still the very last one. Oct 17, 2012 at 18:45
  • @stillanonymous123 You might have to run an ALTER TABLE.
    – fuxia
    Oct 17, 2012 at 18:51
  • As far as I understand I have to update my tables (all of them or just wp_terms?) using ALTER TABLE wp_terms CONVERT TO CHARACTER SET charset? utf8_polish_ci is not a charset according to mysql manual so which one should I use? Thanks a lot! Oct 17, 2012 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.