Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is this possible to do somehow?

In some pages i use a custom box plugin and i don't need to show the content box on some of those pages. Is it possible to hide it by page template? Or ID if template is not possible?

share|improve this question

3 Answers 3

I ended up using userabuser's answer with a small modification, because global $post doesn't seem to exist on init. You can instead just query for post in querystring, like so:

function remove_editor() {
    if (isset($_GET['post'])) {
        $id = $_GET['post'];
        $template = get_post_meta($id, '_wp_page_template', true);

        if($template == 'template_name.php'){ 
            remove_post_type_support( 'page', 'editor' );
        }
    }
}
add_action('init', 'remove_editor');
share|improve this answer

add this to functions.php

add_action('init', 'remove_content_editor');

function remove_content_editor() {
    remove_post_type_support( 'posttype', 'editor' );
}

Replace posttype with the name of the post type. It will remove the content editor from that post type's pages

share|improve this answer

To remove the editor based on template, you may do something like;

add_action('init', 'remove_editor');

function remove_editor() {
    global $post;
    $template = get_post_meta($post->ID, '_wp_page_template', true);

    //change 'page' to whatever post type you want to apply this to.
    if($template == 'template_name.php'){ 
        remove_post_type_support( 'page', 'editor' );
    }

}
share|improve this answer
    
Seems about right, i'll give this a shot. –  qwerty Oct 17 '12 at 8:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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