I hope the title makes sense. I currently want to hide the default WYSIWYG editor on some of the pages but display it on others.
Is there a filter or a hook for the functions file?
I hope I understood your question right.
The following code will remove the editor from the pages using particular templates:
<?php
function wpse242371_remove_editor_from_some_pages()
{
global $post;
if( ! is_a($post, 'WP_Post') ) {
return;
}
/* basename is used for templates that are in the subdirectory of the theme */
$current_page_template_slug = basename( get_page_template_slug($post_id) );
/* file names of templates to remove the editor on */
$excluded_template_slugs = array(
'tmp_file_one.php',
'tmp_file_two.php',
'tmp_file_three.php'
);
if( in_array($current_page_template_slug, $excluded_template_slugs) ) {
/* remove editor from pages */
remove_post_type_support('page', 'editor');
/* if needed, add posts or CPTs to remove the editor on */
// remove_post_type_support('post', 'editor');
// remove_post_type_support('movies', 'editor');
}
}
add_action('admin_enqueue_scripts', 'wpse242371_remove_editor_from_some_pages');
remove_post_type_support('page', 'editor');
didn't know this was a thing
Commented
Oct 12, 2016 at 15:39
remove_post_type_support( 'page', 'editor' );
You can use it in several ways, a checkbox in the page would be nice, which if checked will hide the editor.
For more info > https://codex.wordpress.org/Function_Reference/remove_post_type_support