Default Wordpress Editor

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

Published August 18, 2017 by 4 Comments

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: , ,

Comments

  • Peter says:

    Well, it works… but it would be significantly more useful if you could actually put this code in the template file itself.

    • Mike Little says:

      At this stage, we are confident that new and proficient app developers will be able to handle that task themselves 🙂

  • Amy Miller says:

    Simple and straight to the point! I had been looking for the answer for this for a few days. I was having the same issue with a theme I had been using and it was really annoying me. I already paid for it so I didn’t want to throw money out the door. Thanks for this! Worked like a charm!

Leave a Reply

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