Opened 3 years ago
Closed 2 months ago
#42500 closed defect (bug) (duplicate)
Enable Revisions when there is 1
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.6 |
Component: | Revisions | Keywords: | |
Focuses: | administration | Cc: |
Description (last modified by )
Hello,
I was trying to get revisions to appear for a post and found that it requires 2 revisions to operate due to the conditional;
if ( count( $revisions ) > 1 ) {
Can this be amended to be > 0 or event just if ( count( $revisions ) ) {
Thanks
Change History (6)
#2
@
3 years ago
Thanks @dd32,
I think the main issue I'm having is with pages that've existed for a while. We launched and used WP-Optimize to purge auto-saves and revisions. And while attempting to demonstrate revisions they didn't appear for pages we knew there was revisions for. And checking the database we could see multiple there, none of which were autosaves.
So the link/metabox wasn't displayed when there was a revision to compare against. It's too bad autosave and revision aren't unique post_types, is there another way to easily look up number of actual revisions and instead use it to gauge against? As in many cases there won't be an autosave created as you're able to disable that by extending the autosave interval.
I feel as soon as there's a valid revision then revision functionality should be made available, so if wp_get_post_revisions needs to be supplied some args to filter auto-saves from it's results and have the check be against only revisions that would have saved my tutorial.
During my tutorial I had just messed some content and wanted to roll back but wasn't able to live. Had to find it in the DB to restore, and then only after testing did I realize if I'd pushed a second revision in it would be available.
We also regularly clear the DB of autosaves/revisions so for our clients when they're editing there isn't a revision until they save, but if they break something to them they have no ability to roll back. For now I'll inform them to save a second time to generate an additional revision so they can get the GUI and rollback to the original state of the page.
Thank you
For some context of why
> 1
, I believe that's due to the expectedauto-draft
which isn't really a revision.So you'd have 1 "revision" = Post + Auto-Draft (the auto-draft shouldn't have any real content at this point), and then 2 revisions = Post + Auto-Draft + First actual revision (that is different and can then be compared to).
Displaying the link when there isn't any revisions at all doesn't seem like a very good UX to me, perhaps you can expand on why you think that'd be a good idea?