I use the following code to output WordPress pages ordered by page title.
$args = array(
'sort_order' => 'asc',
'sort_column' => 'post_title',
'hierarchical' => 1,
'child_of' => $page,
'parent' => -1,
'post_type' => 'page',
'post_status' => 'publish'
);
$pages = get_pages($args);
It works fine except for pages starting with non-latin characters. Ã gets sorted as A, it should be in the end, following our Swedish alphabet.
You can try this.
It seems that the regular
utf8_general_ci
does not solve this issue with Swedish letters. This SQL command solved the issues.There is a fantastic plugin named Convert WP Database to UTF-8. I use it all the time. This plugin adds a sub-menu page named “UTF-8 DB Converter” to the Plugins Menu. Simple click on “Start converting” and the plugin will automatically execute the required SQL queries to alter the character set and collation of all your existing WordPress tables.
You only need to do it once per website, and the problem is fixed for good. You can then uninstall the plugin.
Although this plugin has always run without a hitch for me, it is proper practice to make a backup of your WordPress database before attempting this procedure.