Remove weird characters like ö and ä from file names in WordPress. Aka, sanitise file upload image names.

Sometimes when you move your site to another server and the database has different charset (or something else mysterious happens), you may find some of your images broken cause of the weird characters in the names. To be on the safe side, it's nice to sanitise the file names.

There is a simple function to do it. Just paste this into your themes functions.php file.

add_filter('sanitize_file_name', 'sa_sanitize_chars', 10);
    function sa_sanitize_chars ($filename) {
    return remove_accents( $filename );



Club-Mate, the beverage →