Revision: 62736
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 9, 2013 03:26 by rickahontas
Initial Code
<?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
if ( ! defined( 'WP_ADMIN' ) || ! WP_ADMIN )
return false;
// Always include for ajax
if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
return true;
// Check for post IDs
// $checked_post_IDs = array (1,2,3,4);
$checked_post_IDs = array( 104 );
if ( isset( $_GET['post'] ) )
$post_id = $_GET['post'];
elseif ( isset( $_POST['post_ID'] ) )
$post_id = $_POST['post_ID'];
else
$post_id = false;
$post_id = (int) $post_id;
if ( in_array( $post_id, $checked_post_IDs ) ) {
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;
}
?>
Initial URL
Initial Description
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.
Initial Title
Hide Page/Post Editor in Admin Backend
Initial Tags
post, page, wordpress
Initial Language
PHP