mercredi 4 février 2015

Remove Content edit box from ALL pages (not posts)


I've found several function examples online that remove the content editor based on the template of the page. The issue I am having is that the content is not a post, but the wordpress generic "page" functionality.


I want to remove the main content editor from all pages - not custom post type, just standard WP page.


I have tried the code below. However I believe the edit on the templat-file part is incorrect because this is not a post type:



add_action( 'admin_init', 'hide_editor' );

function hide_editor() {
// Get the Post ID.
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;
if( !isset( $post_id ) ) return;

// Get the name of the Page Template file.
$template_file = get_post_meta($post_id, '_wp_page_template', true);

if($template_file == 'page.php'){
remove_post_type_support('page', 'editor');
}
}


How else can I do this to all pages ?





Aucun commentaire:

Enregistrer un commentaire