WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to use $allowedposttags to allow extra HTML tags during entry submission. Can I allow all attributes for a specific tag using $allowedposttags?

For example, the code below will allow iframe tags and the src, height, and width attributes in the iframe tags:

$allowedposttags['iframe'] = array(
    'src' => array(),
    'height' => array(),
    'width' => array()

How can I allow all attributes in this example, not just src, height, and width?

share|improve this question
I'm starting to think that this isn't possible with just $allowedposttags. On line 718 of wp-includes/kses.php, attributes that aren't present in $allowedposttags are skipped. – getWeberForStackExchange Nov 12 '12 at 19:20
kses is designed to be a whitelist. There's no option to allow unlimited attributes without rewriting a lot of it. This is for safety. – Otto Nov 13 '12 at 1:33
up vote 2 down vote accepted

I'm pretty sure you have to explicitly name all allowed attributes - just use:

$allowedposttags['iframe'] = array (
    'align'       => true,
    'frameborder' => true,
    'height'      => true,
    'width'       => true,
    'sandbox'     => true,
    'seamless'    => true,
    'scrolling'   => true,
    'srcdoc'      => true,
    'src'         => true,
    'class'       => true,
    'id'          => true,
    'style'       => true,
    'border'      => true,

If you can think of others let me know!

share|improve this answer
Skies the limit, I think. If we don't count custom attributes, the spec has the definitive list, I believe. – getWeberForStackExchange Nov 12 '12 at 19:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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