-
-
Save billerickson/d09096f27e1cd5ed8db248bfb2925d53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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