-1

This is my actual HTML

<div style="background:black; padding:15px; margin-right:15px;margin-left:350px;">
Hello2  
<h1>
    This is some thing else
</h1>

But after passing through wp_kses it turns to this. What exception i have to do here?

<div style="background:black;padding:15px;margin-right:15px;margin-left:350px">\n    Hello2  \n    <h1>\n        This is some thing else\n    \n

please help

  • 1
    In what context do you use this code? Why do you use wp_kses in here? – Krzysiek Dróżdż Jun 22 at 11:25
  • @KrzysiekDróżdż this is being echoed in the frontend. This is a dynamic content with HTML so i believe that it has to escaped and best option is wp_kses? – Latheesh V M Villa Jun 22 at 11:29
  • try trim($content) after passing in wp_kses. – Chetan Vaghela Jun 22 at 11:31
  • 1
    @LatheeshVMVilla Where is the HTML coming from? How are you saving/retrieving it and outputting it? You've left out everything that's important for answering the question. – Jacob Peattie Jun 22 at 12:21
  • 1
    Could you include the code in the question? – Jacob Peattie Jun 22 at 12:58

Your Answer

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

Browse other questions tagged or ask your own question.