I have a plugin where I am creating a shortcode that creates a form with a textarea field. I would like the user to be able to insert a complete HTML page into the editor - including the HTML and BODY tags and allow all HTML tags. Whenever I switch from Text to Visual view, paragraph tags get added and all but the H1 tags get removed.

I've tried several methods.

Method 1:

$html_code = "<html><head><title>title of page</title></head><body><h1>Page Heading</h1></body></html>"
$editor_id = "template_code";
$settings = array('textarea_name' => $editor_id, 'tinymce' => array ('toolbar1'=> 'bold,italic'), 'valid_elements'=>'*[*]');
wp_editor ( $html_code, $editor_id, $settings );

The toolbar settings are working, but the valid_elements has no effect.

Method 2:

function my_format_TinyMCE( $in ) {
    $in['toolbar1'] = 'bold';
    $in['toolbar2'] = 'italic';
    $in['valid_elements'] = '*[*]';
    $in['verify_html'] = false;
add_filter ( 'tiny_mce_before_init', 'my_Format_TinyMCE' );


And some that I can't remember.

It this even possible? If so, what am I missing?


2 Answers 2


Try this function from leighton.com :

function override_mce_options($initArray) {
    $opts = '*[*]';
    $initArray['valid_elements'] = $opts;
    $initArray['extended_valid_elements'] = $opts;
    return $initArray;
add_filter('tiny_mce_before_init', 'override_mce_options');

Hope that helps.


The solution was to use the fullpage plugin. See: http://www.tinymce.com/wiki.php/Plugin3x:fullpage

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.