function hide_featured_image() {
$post_id = $_GET['post'] ?? ( $_POST['post_ID'] ?? false );
if ( ! isset( $post_id ) ) {
return;
}
$frontpage_id = get_option( 'page_on_front' );
if ( $post_id === $frontpage_id ) {
remove_post_type_support( 'page', 'thumbnail' );
}
}
add_action( 'admin_init', 'hide_featured_image' );