Opened 10 years ago
Last modified 5 years ago
#27938 reviewing defect (bug)
Restore This Autosave does not work for custom post types that don't support 'revisions'
Reported by: | bobbingwide | Owned by: | chriscct7 |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 3.8 |
Component: | Revisions | Keywords: | has-patch |
Focuses: | Cc: |
Description (last modified by )
If you have a custom post type that doesn't support revisions but you manage to create an autosave which is more recent than the current version then you get offered the opportunity to restore it, but the restore action doesn't complete. You end up in an annoying(*) loop.
Expected result: CPT restored to the autosave.
Actual result: Redirected to edit.php for the CPT
Steps to create the problem.
- Ensure your CPT doesn't support 'revisions'
- Create a new post and publish it
- Create an update but don't publish it... just let it autosave
- When you see the "Draft saved" message just quit
- Edit the post again.
- You will be shown the message:
There is an autosave of this post that is more recent than the version below.
- Click on the View the autosave link
- Click on Restore This Autosave button
- End up at the list of posts for this CPT.
- go to step 5.
Introduced by: #23497, change [23769]
Note:
Fixing this bug by simply reinstating the test on !wp_is_post_autosave( $revision ) leads to #27244 being applicable.
In my opinion, this follow on problem is preferable to the current behaviour.
Workaround for developers:
Define 'revisions' support for your CPTs... especially those which support 'editor'.
(*) What's annoying is that you get to see the autosaved version but it's not just a simple case of copying and pasting the text since the two versions get merged.
Attachments (1)
Change History (10)
This ticket was mentioned in IRC in #wordpress-dev by bobbingwide. View the logs.
10 years ago
This ticket was mentioned in IRC in #wordpress-dev by adamsilverstein. View the logs.
10 years ago
#6
@
10 years ago
Indeed, autosaves are a special type of revision and currently you cannot correctly restore them if you have a CPT that doesn't support revisions - even if they are saved. And despite the fact that the message indicates you can. Wrong!
Your solution seems reasonable, another approach would be not doing autosaves for CPTs with revisions disabled;
Maybe the most robust solution would be to introduce an option supports->'autosaves' for custom post types and enable/disable based on that - that way autosaves gains a little autonomy, even if it is still a special type of revision in the back end.
Patch to reinstate test for autosave when post type doesn't support revisions