[wp-trac] [WordPress Trac] #36262: Page Restore Autosave Not Working

WordPress Trac noreply at wordpress.org
Tue May 24 05:14:09 UTC 2016


#36262: Page Restore Autosave Not Working
-----------------------------------+------------------------------
 Reporter:  jawad96                |       Owner:  adamsilverstein
     Type:  defect (bug)           |      Status:  assigned
 Priority:  normal                 |   Milestone:  4.6
Component:  Revisions              |     Version:  3.6
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:
-----------------------------------+------------------------------
Changes (by adamsilverstein):

 * keywords:  dev-feedback => has-patch 2nd-opinion
 * component:  Autosave => Revisions
 * milestone:  Awaiting Review => 4.6


Comment:

 @jawad96 Thanks again for the bug report.

 I tracked this down to a flaw in the logic applied when restoring a
 revision. The code checks to make sure the revision you are attempting to
 restore is valid, and one check is for the 'WP_POST_REVISIONS' setting.
 Previously the code here allowed autosaves to be restored, but at some
 point in the past this logic was changed and autosaves were excluded -
 thus breaking the restore entirely if revisions are disabled (as you
 reported).  I think we removed this because the use case you describe
 wasn't caught.

 Fortunately, when we changed this, we left a comment in the code:
 `Revisions disabled (previously checked autosaves && !
 wp_is_post_autosave( $revision ))` that made it pretty  straightforward
 how to re-introduce the autosave check to the restore.

 Can you test the attached patch to verify it resolves the issue for you? I
 tested on my end and the restore of my autosave now works properly with
 `define('WP_POST_REVISIONS', false );`

 In [attachment:36262.diff]:
 Allow autosaves to be restored when revisions are disabled.

 * fixes the restore logic to allow restoring autosaves

 I took some screencasts to visually record the issue:

 Before patch:
 http://cl.ly/3M1W3l1d0L1g

 After patch:
 http://cl.ly/0p0C120m1N44

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36262#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list