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:


function wpse242371_remove_editor_from_some_pages()
    global $post;

    if( ! is_a($post, 'WP_Post') ) {

    /* 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(

    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');
| improve this answer | |
  • I think that is exactly what I'm looking for... Thanks!! remove_post_type_support('page', 'editor'); didn't know this was a thing – kcroake88 Oct 12 '16 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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.