I am building a Wordpress site that is going to be multilingual (using WPML) and it will host a ton of resources in multiple languages - from Chinese to Russian to English, etc. We wanted to upload the files using the native languages filename and I was going to add a filter to sanitize_file_name
to accomplish this. After some reading, I cannot find a good explanation of why this may not be a good idea.
My question is, why would this not be a good idea? Should I avoid this? What implications would it have if I allowed all characters to be used?
Thanks for your help!
sanitize_file_name
to what? You said to accomplish this this - what? Uploading different language's filename, to me, is not a problem. But, for critical glyphs like Chinese, Bengali they take more char-space than English, and for large filenames, they can be trimmed to incomplete wordings. But local filenames can be a good plus point for local SEO.sanstize_file_name
because as of now, it adds dashes in the place of spaces and specific characters like those of Chinese file names. So, are you saying that it is not necessarily a bad idea? What about for the permalinks? Would it just add%
to the characters that it does not recognize? How would that translate?hyphen
is a very good separator and recommended. And I questioned about this sometime. You can avoid 404 for local filenames using a permalink ofexample.com/id/filename
.