Custom DB_COLLATE (collation) value not working on fresh install?

You only have 1 option here, which by most standards isn’t advised. You have to edit a core WordPress file: wp-db.php

The reason is that there are no filters to change these and the code is kinda hard-coded. WordPress checks the availability of collation it selects though. If you need it just enough to setup your site and no more, modifying the file temporary would work. Note that as soon as WordPress is updated, this code will likely be replaced.

Steps:

  1. Open up the file /wp-includes/wp-db.php for editing
  2. locate the function called determine_charset(). In WordPress 4.8.1 it is on line 773
  3. Make the first line of the function return compact( 'charset', 'collate' );
  4. Save your file.

The function would look as follows:

public function determine_charset( $charset, $collate ) {
          return compact( 'charset', 'collate' );

Do not delete anything, just add that 1 line below the function definition.

  • Also, this assumes that you have your custom Charset and Collate specified in your WP Config.