Wordpress - remove visual editor
// Remove visual editor from a custom post type editing page
function remove_editor_init() {
//remove editor for all registries
remove_post_type_support('registry', 'editor');
//remove editor for pages whose parent page id is 321
if (isset($_GET['post'])) {
$post_id = $_GET['post'];
} else if (isset($_POST['post_ID'])) {
$post_id = $_POST['post_ID'];
} else {
return;
}
$parents = get_post_ancestors($post_id);
if ($parents) {
$topparent_id = $parents[count($parents)-1];
}
if ($topparent_id === 321) {
remove_post_type_support('page', 'editor');
}
}
add_action('admin_init', 'remove_editor_init');