wordpress snippets last updated   : October 6, 2014
we now have 641 snippets

Disable the visual editor for posts and pages

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will disable the visual editor for both posts and pages.

snippet :  PHPcopy
add_filter('user_can_richedit' , create_function('' , 'return false;') , 50);

Did you like this post? If so please share it with your friends. Thanks!

  • http://www.cliffpaulick.com Cliff Paulick

    How do you make the editor totally gone (e.g. display:none; ) for certain post types? For example, all content will be by filling out custom fields. Thanks, Kevin.

    • http://wpsnipp.com Kevin Chard

       Hi Cliff, This is a sample custom post type


      function sample_post_type() {
          register_post_type( 'sample_cpt',
              array(
                  'labels' => array(
                      'name' => __( 'Sample' ),
                      'singular_name' => __( 'Sample' ),
                  ),
              'public' => true,
              'menu_position' => 5,
              'rewrite' => array('slug' => 'sample'),
              'supports' => array('title','thumbnail','editor'),    // supports options

              )
          );
      }
      add_action( 'init', 'sample_post_type' );

      The following can be added,

      ‘title’
      ‘editor’ (content)
      ‘author’
      ‘thumbnail’ (featured image, current theme must also support)
      ‘excerpt’
      ‘trackbacks’
      ‘custom-fields’
      ‘comments’ (also will see comment count balloon on edit screen)
      ‘revisions’ (will store revisions)
      ‘page-attributes’ (menu order, hierarchical must be true to show Parent option)
      ‘post-formats’ add post formats, 

      http://codex.wordpress.org/Function_Reference/register_post_type

      So if you remove the option editor from that array above it will not display the editor, then add excerpt or what ever other options you would like.