添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Visit Stack Exchange

WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.

Sign up to join this community

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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');
                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.
– Zach Lysobey
                Oct 24, 2011 at 21:07
                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.
– Cazuma Nii Cavalcanti
                Feb 3, 2021 at 0:27

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' );
        

Thanks for contributing an answer to WordPress Development Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.