2

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?

Thanks

3
  • Why disallow div tags??
    – NoBugs
    Commented Aug 3, 2015 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
    Commented Aug 3, 2015 at 8:20
  • Wasn't that fixed with TinyMCE 4?
    – NoBugs
    Commented Aug 3, 2015 at 11:57

1 Answer 1

1

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

unset($allowedposttags['div']);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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