Default Wordpress Editor

WordPress: Hiding default content editor (WYSIWYG) for a specific template

Published August 18, 2017 by Leave a comment

We recently needed to hide the default editor for the home page of a client’s wordpress website. The reason was that we were using the incredibly useful Advanced Custom Fields (ACF) plugin.

The following code, placed in the functions.php file did exactly what we needed.

add_action( 'admin_head', 'hide_editor' );
function hide_editor() {
	$template_file = basename( get_page_template() );
	if($template_file == 'template-home.php'){ // template
		remove_post_type_support('page', 'editor');
	}
}

Reference: https://gist.github.com/ramseyp/4060095

Tags: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *