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

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.

Smug Piggy for the Latest Men's & Women's T-shirts
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

4 responses to “WordPress: Hiding default content editor (WYSIWYG) for a specific template

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

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

  2. 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 *