Skip to content

Instantly share code, notes, and snippets.

@dividezigns
Created May 30, 2018 02:35
Show Gist options
  • Save dividezigns/0aad790933e4fcc2d2f093f022d2e600 to your computer and use it in GitHub Desktop.
Save dividezigns/0aad790933e4fcc2d2f093f022d2e600 to your computer and use it in GitHub Desktop.
This code will hide the WordPress editor bases on a custom template. Good if you're using your own fields. You can add this code snippet to your functions.php file in your child theme directory.
<?php
add_action( 'admin_head', 'hide_editor' );
function hide_editor() {
$template_file = basename( get_page_template() );
if($template_file == 'template-name.php'){
remove_post_type_support('page', 'editor');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment