I know one can modify the kses filter to add new allowed tags to it, but is there a way to remove some of them? I can't find how. I need to disallow DIV tags.

Any ideas?


  • Why disallow div tags?? – NoBugs Aug 3 '15 at 4:22
  • I needed this for a client who insisted on pasting content from sites with malformed HTML in the editor, thus screwing the site design as a result. At the end, enabling the use_balanceTags option was enough. – leemon Aug 3 '15 at 8:20
  • Wasn't that fixed with TinyMCE 4? – NoBugs Aug 3 '15 at 11:57

The allowed tags are stored in $allowedposttags (located in /wp-includes/kses.php) as an array. For each element it looks something like this:

$allowedposttags = array(
  'div' => array(
    'align' => true,
    'dir' => true,
    'lang' => true,
    'xml:lang' => true,

You can remove a single element of an array via unset


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.