0

I have a custom website in which I am using wp_insert_post() to manually create posts that have a title which has characters thare are non-English Unicode letters (Arabic to be more specific).

The URL that gets created by wp_insert_post() is something similar to the following:

http://example.dev/%d8%b1%d9%88%d8%b3%d9%8a%d8%a7-%d8%a7%d9%84%d8%b9%d9%85%d9%84-%d8%b9%d9%84%d9%89-%d8%a7%d8%a8%d8%aa%d9%83%d8%a7%d8%b1-%d9%84%d9%82%d8%a7%d8%ad-%d9%81%d8%b9%d8%a7%d9%84-%d8%b6%d8%af-%d9%85%d8%b1/

(note that I have permalinks enabled)

Now, how do I prevent the above link from being saved as show? How do I ensure the Unicode characters are used instead of the %-and-number combination for each letter?

1

Do not touch that string. URLs must be percent-encoded, and what you see is the slug for the URL. A browser will display the characters just fine, so don’t worry about the database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.