WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 20 months ago

#42500 new defect (bug)

Enable Revisions when there is 1

Reported by: garrett-eclipse Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.6
Component: Revisions Keywords:
Focuses: administration Cc:
PR Number:

Description (last modified by dd32)

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 ) {

https://github.com/WordPress/WordPress/blob/a72be13ec0b57a2831d75540fd1892d1bd121f3b/wp-admin/edit-form-advanced.php#L234

Can this be amended to be > 0 or event just if ( count( $revisions ) ) {

Thanks

Change History (5)

#1 @dd32
2 years ago

  • Description modified (diff)

For some context of why > 1, I believe that's due to the expected auto-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?

#2 @garrett-eclipse
2 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

This ticket was mentioned in Slack in #bbpress by garrett-eclipse. View the logs.


2 years ago

#4 @Clorith
2 years ago

  • Version changed from 4.9 to 3.6

Related #24804

This ticket was mentioned in Slack in #forums by clorith. View the logs.


20 months ago

Note: See TracTickets for help on using tickets.