Created
May 10, 2013 05:07
-
-
Save erikccoder/5552502 to your computer and use it in GitHub Desktop.
wordpress remove editor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| 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