If a post includes invalid characters such as πΈπππ½, they do not get sanitized.
The fix would be to use the core wp_unique_filename function which internally calls sanitize_file_name that fixes the issue. This would also solve the suffixed counters without custom code.
If a post includes invalid characters such as πΈπππ½, they do not get sanitized.
The fix would be to use the core
wp_unique_filename
function which internally callssanitize_file_name
that fixes the issue. This would also solve the suffixed counters without custom code.