#26577 closed defect (bug) (wontfix)
Unable to compare post with single revision
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.6 |
Component: | Revisions | Keywords: | has-patch |
Focuses: | Cc: |
Description
If your post type supports 'revisions', the "Revisions" meta box, and the revisions section of the "Publish" meta box, are only added to your edit post screen if you have more than one revision.
But what if you only have one revision that you want to view/compare? Shouldn't the logic be "if ( count( $revisions ) >= 1 )"?
The logic is on line 128 of the wp-admin/edit-form-advanced.php file.
Here's the code starting with line 124:
if ( post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status ) { $revisions = wp_get_post_revisions( $post_ID ); // 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'); } }
Attachments (1)
Change History (8)
#2
in reply to:
↑ 1
@
11 years ago
- Keywords has-patch added
This is a slightly difficult situation, because in the situation where an auto-draft has been created, saving the post in the admin for the first time will create a revision - but if the post is created without an auto-draft (being created automatically by some means, or simply being created too quickly for the auto-draft functionality to kick in), the first change to the post will also create the first revision - which will then cause the revision UI not to display, despite the fact that there is a revision available.
(This also happens if you restrict the number of revisions to 1, it appears.)
My personal feeling (since I ran into this situation with the revision UI not displaying despite a revision being present) is that it's slightly better, absent a more subtle handling of auto-draft to real post causing revisions, to display the revision UI if there are any revisions at all, not just more than one; attached patch does so.
#3
@
11 years ago
leaving aside the auto-draft for now, the single revision is always the same as the current post, so there would be nothing to show on the revisions screen even if you could go there - it would just show the content of the post as all new 'added' content. as soon as you save any changes to the post there will be two revisions and you can go back to compare what changed in each.
Related: [23506], [23631], [23929], [24790].