Hide Empty Editor

If you’re using custom metaboxes for all the post’s content, you may want to hide the editor for a cleaner editing experience. But what about the old content that still uses the editor? This code only hides the main editor once it is empty (once the metaboxes are the only sources of content).

/**
 * Hide empty editor on posts
 *
 */
function ea_hide_empty_editor() {

	$screen = get_current_screen();
	if( $screen->id !== 'post' )
		return;

	$hide = true;
	if( isset( $_GET['post'] ) && !empty( get_post( $_GET['post'] )->post_content ) ) {
		$hide = false;
	}

	if( $hide ) {
		remove_post_type_support( 'post', 'editor' );
	}
}
add_action( 'admin_head', 'ea_hide_empty_editor' );

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk