最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

theme options - How to support special characters in text field?

programmeradmin5浏览0评论

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
 |  Show 2 more comments

2 Answers 2

Reset to default 0

Wordpress 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.

发布评论

评论列表(0)

  1. 暂无评论