Sanitise in WordPress but keep html

Posted by Prem Tiwari | Updated on

Sanitise in WordPress but keep html. wp_kses() will do what you need. You need to tell it what tags to allow. Alternatively use wp_kses_post() which allows anything you can add to a post. This one may not be strict enough for user input though so I’d suggest going with the first.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers