Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active April 15, 2017 01:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save billerickson/d09096f27e1cd5ed8db248bfb2925d53 to your computer and use it in GitHub Desktop.
Save billerickson/d09096f27e1cd5ed8db248bfb2925d53 to your computer and use it in GitHub Desktop.
<?php
/**
* 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' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment