Hiding the Editor

The usual post editor can be hidden after all! Without removing support for it when registering the post type.

Add the following code to the constructor for the meta box class described in previous posts on creating custom meta boxes.

//hide editor if adding a new post of sermon type
		if( isset( $_GET['post_type'] ) && 'sermon' == $_GET['post_type'] ) {
			add_action( 'admin_head', array( &$this, 'hide_editor' ) );

Add this as a function in the class.

	function hide_editor() {
				#editor-toolbar { display: none; }
				#editorcontainer {display: none; }
				#quicktags {display:none;}
				#post-status-info {display:none;}

The code for hiding the editor was taken from http://wordpressapi.com/2011/03/19/hide-wordpress-visual-editor-html-editor/


4 thoughts on “Hiding the Editor”

  1. Hi there,

    Just wondering, I am wanting to apply this code to four or five custom post types on which I want to ahve editor capabilities but for users to not see the editor.

    Where would I apply this code, still in functions.php or in edit.php?

    1. put it in functions.php. don’t edit core code or you’ll lose the changes on the next update. I think it’ll actually be better if the code is in a custom plugin, but putting it in the theme will work too.

  2. Very useful!

    But to work on functions.php I used like this:

    add_filter(‘admin_head’, ‘hide_editor’);

    function hide_editor() {

    if(get_post_type() == ‘POST-TYPE-1’ || get_post_type() == ‘POST-TYPE-2’) {



    Tip: Use Firebug add-on on Fireworks to identfy IDs and Classes to hide.

    Regards from Brazil!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s