/ Published in: PHP
This is a combined version of Bill Erickson's hide post editor and rilwis' Metabox include for specific IDs. It hides the editor for a specified post ID. You can have multiple IDs, just separate with commas.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php add_action( 'admin_init', 'hide_editor' ); function hide_editor() { // Get the Post ID // $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ; // if($post_id == '104'){ // Include in back-end only return false; // Always include for ajax return true; // Check for post IDs // $checked_post_IDs = array (1,2,3,4); $post_id = $_GET['post']; $post_id = $_POST['post_ID']; else $post_id = false; $post_id = (int) $post_id; remove_post_type_support('page', 'editor'); // add custom .js to footer for uploading images function custom_admin_js() { $url = get_option('siteurl'); $url = get_bloginfo('template_directory') . '/library/js/libs/meta-content.js'; echo '"<script type="text/javascript" src="'. $url . '"></script>"'; } add_action('admin_footer', 'custom_admin_js'); } return true; // If no condition matched return false; } ?>