Changing your WordPress database collation

If characters are not being stored properly on your WordPress site, or if you are using a different language in which the characters that you entered are not the same as what is being displayed, you may need to change your database collation. For example, if you database uses character set that is not utf8_general_ci, you will need to tell WordPress to use a different collation. If you need to change the character set of your database as well, take a look at the WordPress codex page on converting your database character sets. In this article, we will show you how to define a custom database collation within WordPress.

  1. As we will be using the cPanel file manager to edit your wp-config.php file, you will need to log into cPanel and click on the File Manager icon.
  2. Next, you will want to navigate the to the root directory of your WordPress installation. Typically, it will be in your public_html directory.
  3. Once you’ve found the wp-config.php file, right-click it and click on Code Edit.
  4. Inside this file, locate a link that says:

    define( ‘DB_COLLATE’, ” );

  5. Within this line, you may set your collation between the two single quotes. For example, it may look something like this:

    define( ‘DB_COLLATE’, ‘utf8_general_ci’ );

  6. Be sure to save your settings when done.

The following are examples of collation that can be used for UTF-8 character sets:

  • utf8_bin
  • utf8_czech_ci
  • utf8_danish_ci
  • utf8_esperanto_ci
  • utf8_estonian_ci
  • utf8_general_ci (default)
  • utf8_hungarian_ci
  • utf8_icelandic_ci
  • utf8_latvian_ci
  • utf8_lithuanian_ci
  • utf8_persian_ci
  • utf8_polish_ci
  • utf8_roman_ci
  • utf8_romanian_ci
  • utf8_slovak_ci
  • utf8_slovenian_ci
  • utf8_spanish_ci
  • utf8_spanish2_ci
  • utf8_swedish_ci
  • utf8_turkish_ci
  • utf8_unicode_ci

Was this article helpful? Join the conversation!

Questions about our MailChannels Deployment? We have answers and are here to help!Learn More
+