
[*]
I’m trying to paste a youtube iframe in to the TinyMCE Editor. Now it always removes the width
and height
attributes when switching from TEXT to visual. Now this is ok if values are empty, but if values exist I might need them..
I’ve tried with the following code in functions.php
function tinyMCEoptions($options) {
$options['extended_valid_elements'] = 'iframe[*]';
return $options;
}
add_filter('tiny_mce_before_init', 'tinyMCEoptions');
Which does work for all attributes but not for width and height. I’ve also tried
$options['extended_valid_elements'] = 'iframe[width|height|*]';
but it doesn’t work. See here:
How can I make TinyMCE keep width and height for iframe
?
Thanks for helping
1 Answer
[*]
This took me ages to figure out but here is how it works now just add below code to the functions:
function tinyMCEoptions($initArray) {
$options="*[*]";
$initArray['valid_elements'] = $options;
$initArray['extended_valid_elements'] = $options;
return $initArray;
}
add_filter('tiny_mce_before_init', 'tinyMCEoptions');