+
+$publish_callback_args = null;
+if ( post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status ) {
+ $revisions = wp_get_post_revisions( $post_ID );
+
+ // Check if the revisions have been upgraded
+ if ( ! empty( $revisions ) && _wp_get_post_revision_version( end( $revisions ) ) < 1 )
+ _wp_upgrade_revisions_of_post( $post, $revisions );
+
+ // We should aim to show the revisions metabox only when there are revisions.
+ if ( count( $revisions ) > 1 ) {
+ reset( $revisions ); // Reset pointer for key()
+ $publish_callback_args = array( 'revisions_count' => count( $revisions ), 'revision_id' => key( $revisions ) );
+ add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core');
+ }
+}
+