4

I am using the simple fields plugin to provide additional rich text editors and have no need for this 'main' text editor box on any of my 'page's

I have tried the following code in my functions.php:

function my_remove_meta_boxes() {
remove_meta_box('postdivrich','page','normal');
}
add_action( 'admin_menu', 'my_remove_meta_boxes' );

Apparently this will not work since it is not actually a meta box...

I suppose I could sneak some jQuery in somewhere: ('#postdivrich').hide() but I am not really sure where to put it, and suspect that there is a better way.

Any help would be greatly appreciated

Edit: this question describes how to do what I want, but for a custom post type. Can I apply this same technique to 'pages' somehow?

Edit 2: Using noob power I made something work, but for all post-types and with it flashing on screen before being hidden. I skipped JQuery and went straight for plain ole JS:

//REMOVE MAIN TEXT CONTENT BOX FOR PAGES
function removeMainTxtContent(){
    echo '<script>window.onload=function(){document.getElementById("postdivrich").style.display="none";}</script>';
}add_action('admin_head', 'removeMainTxtContent');

2 Answers 2

13

see remove_post_type_support

function remove_pages_editor(){
    remove_post_type_support( 'page', 'editor' );
}   
add_action( 'init', 'remove_pages_editor' );
3
  • 2
    uh Oh... sorry to remove the check mark. There were some unforseen ramifications to this method. This removed the rich text editing (tinymce stuff) from my custom fields. Commented Oct 24, 2011 at 21:07
  • 1
    Thanks milo. didnt know remove_post_ty.... opened a lot of options for me :)
    – Sagive
    Commented Nov 7, 2011 at 3:03
  • Is there a way to remove the main editor without breaking the custom rich text fields? I've got the same situation described by the OP. I'm using CMB2 to create the custom fields. Commented Feb 3, 2021 at 0:27
1

To completely remove the text editor from your custom post type, add this into functions.php:

function remove_editor() {
    remove_post_type_support( 'your_post_type', 'editor' );
}
add_action( 'admin_menu' , 'remove_editor' );

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.