我将尝试做一个更完整的回答:
If you want to remove all the content editor
@Oleg Butuzov的答案很好:
add_action(\'init\', \'init_remove_support\',100);
function init_remove_support(){
$post_type = \'your post type\';
remove_post_type_support( $post_type, \'editor\');
}
If you want only disable tinymce but let html toolbars
@biziclop的答案很好:
add_filter(\'user_can_richedit\', function( $default ){
global $post;
if( $post->post_type === \'product\') return false;
return $default;
});
在这种情况下
wp-content-editor-tools
已可见,因为展开编辑器。js插入工具栏。
If you want to replace the tinymce editor by a simple textarea
我找到了答案
here.
function wpse_199918_wp_editor_settings( $settings, $editor_id ) {
if ( $editor_id === \'content\' && get_current_screen()->post_type === \'custom_post_type\' ) {
$settings[\'tinymce\'] = false;
$settings[\'quicktags\'] = false;
$settings[\'media_buttons\'] = false;
}
return $settings;
}
add_filter( \'wp_editor_settings\', \'wpse_199918_wp_editor_settings\', 10, 2 );