Disable content editor for specific page template
wordpress snippet
Adding this snippet to the functions.php of your wordpress theme will disable the content editor when a page is using a specific template. Don’t forget to change the name of the template file on line 08 this sample I have submit.php but can be changed to anything.
snippet : PHPcopy
add_action( 'admin_init', 'hide_editor' );
function hide_editor() {
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;
if( !isset( $post_id ) ) return;
$template_file = get_post_meta($post_id, '_wp_page_template', true);
if($template_file == 'submit.php'){ // edit the template name
remove_post_type_support('page', 'editor');
}
}
this months featured snippets
- http://www.cliffpaulick.com Cliff Paulick
- http://wpsnipp.com Kevin Chard






