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.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745465265a4628889.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