Skip to content

Instantly share code, notes, and snippets.

@rdallaire
Created October 28, 2013 20:06
Show Gist options
  • Select an option

  • Save rdallaire/7203648 to your computer and use it in GitHub Desktop.

Select an option

Save rdallaire/7203648 to your computer and use it in GitHub Desktop.
Remove WYSIWYG editor for page templates
add_action('init', 'remove_editor_init');
function remove_editor_init() {
// if post not set, just return
// fix when post not set, throws PHP's undefined index warning
if (isset($_GET['post'])) {
$post_id = $_GET['post'];
} else if (isset($_POST['post_ID'])) {
$post_id = $_POST['post_ID'];
} else {
return;
}
$template_file = get_post_meta($post_id, '_wp_page_template', TRUE);
if ($template_file == 'page-your-template.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