3

If I run this code then I no longer get the toolbar but I still get a word count and visual/html tabs and when I save the post my content gets wrapped in <\p> tags.

jQuery(document).ready(function() {
    jQuery('#content').removeClass('theEditor').addClass('mceNoEditor');

    tinyMCE.init({
      mode: "none",
      editor_deselector : "mceNoEditor"      
    });

What is the correct way to keep a textarea and not let tinymce override it?

2 Answers 2

1

You can remove the wp-autop function which WordPress uses to format the output of the WYSIWYG editor. It will stop tinymce from adding additional p tags, but will require you to add correct formatting (because you're removing the wp-autop the output won't be altered. This if you use the visual editor and it doesn't convert the visual input to valid HTML tinymce will no longer attempt to correct it).

If you still want to try, here is the code to add to your functions.php file:

<?php remove_filter ('the_content', 'wpautop'); ?>
1

This should work:

add_filter( 'user_can_richedit', 'wpse24935_remove_richedit', 99 );
function wpse24935_remove_richedit( $bool ){
     return $false;
}

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.