Skip to content

Instantly share code, notes, and snippets.

@erikccoder
Created May 10, 2013 05:07
Show Gist options
  • Select an option

  • Save erikccoder/5552502 to your computer and use it in GitHub Desktop.

Select an option

Save erikccoder/5552502 to your computer and use it in GitHub Desktop.
wordpress remove editor
/*
Disable content editor for specific page template
*/
add_action('admin_init', 'hide_editor');
function hide_editor() {
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'];
if (!isset($post_id)) return;
$template_file = get_post_meta($post_id, '_wp_page_template', true);
if ($post_id == 2) {
echo "remove editor";
remove_post_type_support('page', 'editor');
}
if ($template_file == 'post.php') { // edit the template name
remove_post_type_support('page', 'editor');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment