Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm looking for a solution that would allow me to write tags inside posts and be sure that the visual editor or wordpress will not alter them.

The same problem can apply for other specific HTML code that I may want to use.

Disabling the visual editor is not an option, because in will render most edit operation too hard to use.

share|improve this question

1 Answer

up vote 6 down vote accepted

Add the following to your theme functions.php:

function fb_change_mce_options($initArray) {
    $ext = 'script[charset|defer|language|src|type]';

    if ( isset( $initArray['extended_valid_elements'] ) ) {
        $initArray['extended_valid_elements'] .= ',' . $ext;
    } else {
        $initArray['extended_valid_elements'] = $ext;
    }

    return $initArray;
}
add_filter('tiny_mce_before_init', 'fb_change_mce_options');
share|improve this answer

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.