This is not a complete answer, but it’s an attempt at giving you some direction. Hopefully with the community here we can come up with a solution for you!
Firstly, I’ve been able to replicate your issue:
- I took your code and placed it in my theme’s
functions.php
for now. - I removed the
if( $strict )
test - I tried registering an 8 character Hebrew name – it worked
- I removed your function and tried again – it failed (this confirms your function works)
- I added your function and tried with a 9 character Hebrew name – it failed
(for non-Hebrew speakers following along, I just used Google Translate and translated my own name to Hebrew, then dropped characters).
When it didn’t work, the error I got was:
ERROR: Couldn’t register you… please contact the webmaster !
I’ve never seen this error before. It comes from wp-includes/user.php. What this tell us, hunting through the order of this, is that wp_create_user()
, and therefore wp_insert_user()
, is either returning false or an error object.
wp_insert_user()
has a heck of a lot of filters we could potentially plug into to help this work. It may be tripping up one of these.
Alternatively, it may be a database issue. This StackOverflow answer has some ideas for supporting Hebrew characters in a MySQL database. My table encoding was already set to utf8_general_ci
but my database itself wasn’t, so I changed that and unfortunately it didn’t resolve it. I also tried running the SET NAMES
query through wpdb, but it’s possible it’s not meant to work like that.
Where to from here
I’m hardly a database expert, so I’m not sure if this is a database limitation that we may end up not being able to get around. For now, I think the best chance lies in one of those filters that wp_insert_user()
goes through.
I don’t have time right now to hunt through these in depth and work out where it’s tripping up, but hopefully this gives you a decent head start – if I can I’ll come back and see what else I can find.