Skip to content

Instantly share code, notes, and snippets.

Created August 18, 2017 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/5be3dbc544d0b8048a33c683ce9734d0 to your computer and use it in GitHub Desktop.
Save anonymous/5be3dbc544d0b8048a33c683ce9734d0 to your computer and use it in GitHub Desktop.
WordPress plugin: Disables the visual editor for a specific post type (default: “post”)
<?php
defined( 'ABSPATH' ) or die( 'No direct access here.' );
/**
* Plugin Name: Remove Visual Editor from Post Type
* Description: Disables the visual editor for a specific post type (default: “post”).
* Author: Hans-Helge
* Author URI: https://webschale.de/
* Plugin URI: https://webschale.de/2017/visual-editor-deaktivieren/
* License: GNU General Public License v3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
add_filter ( 'user_can_richedit' , function ( $wp_rich_edit ) {
if ( get_post_type() === 'post' ) {
$wp_rich_edit = false;
}
return $wp_rich_edit;
}, 50 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment