Disable WordPress Content Editor for Specific Template

Here is a pretty function which will help you to disable the WordPress Content Editor for a specific page Template. Just copy and paste the bellow function on your WordPress themes function.php, it will work fine. Don’t forgot to edit “templatename.php” in below function with your file name.

<?php
/**
 
 *Function to  Disable WordPress Content Editor for Specific Template
 
 *
 
 */
 
add_action( 'admin_init', 'disable_wp_editor' );
 
 
 
function disable_wp_editor() {
 
	// Get the Post ID.
 
	$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;
 
	if( !isset( $post_id ) ) return;
 
 
 
	// Get the name of the Page Template file.
 
	$template_file = get_post_meta($post_id, '_wp_page_template', true);
 
 
 
    if($template_file == 'templatename.php'){ // rename this with your template name
 
    	remove_post_type_support('page', 'editor');
 
    }
 
}
?>

Related posts:

Partner with Us

We are providing an exclusive partnership offer to individuals and companies who are interested in setting up their own web design & development company. For more information about how to partner with us, please contact us