Wordpress - Is it possible to remove WYSIWYG for a certain Custom Post Type?
add_action('init', 'init_remove_support',100);
function init_remove_support(){
$post_type = 'your post type';
remove_post_type_support( $post_type, 'editor');
}
place it to your themes functions.php
You can actually disable the WYSIWYG editor, leaving only the html source editor. Choose a function below:
// disable wyswyg for custom post type, using the global $post
add_filter('user_can_richedit', function( $default ){
global $post;
if( $post->post_type === 'product') return false;
return $default;
});
// disable wyswyg for custom post type, using get_post_type() function
add_filter('user_can_richedit', function( $default ){
if( get_post_type() === 'product') return false;
return $default;
});
Alternatively, you can handle post-editor support directly in your register_post_type()
call, via the 'supports'
parameter in the $args
array.
The default value is: 'supports' => array( 'title', 'editor' )
.
You can change it to whatever you need; for example: 'supports' => array( 'title' )
.