When i put special characters in text field on wordpress themes option then it's gonna add some slash characters Like if I put
It's
then its show
It\'s.
How i solve that?
When i put special characters in text field on wordpress themes option then it's gonna add some slash characters Like if I put
It's
then its show
It\'s.
How i solve that?
Share Improve this question edited Mar 14, 2013 at 20:31 fuxia♦ 107k39 gold badges255 silver badges459 bronze badges asked Mar 14, 2013 at 20:01 Tawhidul IslamTawhidul Islam 1013 bronze badges 7- are you trying to add the characters to a word in a php file? – Androliyah Commented Mar 14, 2013 at 20:08
- No, I'm trying on themes option panel. Maybe this option panel does not sanitize special characters. – Tawhidul Islam Commented Mar 14, 2013 at 20:18
- Can you screenshot it? I cant picture your dillema. – Androliyah Commented Mar 14, 2013 at 20:20
- How do you save the options? Add the code to your question. – fuxia ♦ Commented Mar 14, 2013 at 20:28
- I'm using demo.truethemes/CodeCanyon-Pro-Panel/index.html – Tawhidul Islam Commented Mar 14, 2013 at 20:29
2 Answers
Reset to default 0Wordpress always adds slash before quotes as the first step in processing input. You should strip those slashes before saving data into the DB. use stripslashes
for strings or stripslashes_deep
in case you are handling arrays.
You need to escape the apostrophe yourself. Two ways to escape apostrophes is to do this:
It"'"s
Or this:
It\'s
If you do not escape them yourself, you likely end up with the problem you're having now. So try one of these methods in your options panel text box and see if that answers your question.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744345035a4569630.html
评论列表(0条)