Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
1  
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

1 Answer 1

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

 
discard

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.