admin管理员组文章数量:1426066
I have an html containing   but I am unable to pass it through wp_kses(). I have tried adding allowed html array(' ' => array(),)
but does not seems to work.
I there a way or I should not do that?
I have an html containing   but I am unable to pass it through wp_kses(). I have tried adding allowed html array(' ' => array(),)
but does not seems to work.
I there a way or I should not do that?
https://stackoverflow/questions/2300142/how-to-add-extra-whitespace-in-php/23844752
Share Improve this question edited May 25, 2019 at 11:52 asked May 25, 2019 at 11:06 user145078user145078 6 | Show 1 more comment1 Answer
Reset to default 3not sure the difference but I used
 
for adding a white space ..then passed it throughwp_kses()
The correct HTML entity for a non-breaking space is
— note the ;
which is required and without it (i.e.  
), the entity is not valid and when used with wp_kses()
, you'd get &nbsp
instead of a non-breaking space.
strangely it was working fine before I used
wp_kses()
I'm pretty sure it's because the browser is smart enough and auto-corrected it to
. :-)
So, always use valid HTML entities and also tags (e.g. close a <div>
with a </div>
), regardless you use wp_kses()
or not. Don't rely on "intelligent guess" or auto correction by the browser.
本文标签: escapingHow to allow ampnbsp with wpkses()
版权声明:本文标题:escaping - How to allow &nbsp with wp_kses()? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745465265a2659505.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
 
or
? And what's the exactwp_kses()
code you used? – Sally CJ Commented May 25, 2019 at 11:46 
for adding a white space ..then passed it through wp_kses() – user145078 Commented May 25, 2019 at 11:50
is the correct one - the;
is required. Otherwise, that's an invalid HTML entity and 
would result in&nbsp
. – Sally CJ Commented May 25, 2019 at 11:52