Opened 5 years ago
Last modified 2 weeks ago
#7392 reopened defect (bug)
Don't create new autosave revision if nothing has changed yet
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.6 |
| Component: | Autosave | Version: | 2.6 |
| Severity: | minor | Keywords: | has-patch needs-testing 3.6-early autosave-redo |
| Cc: | AmbushCommander, kurtpayne, adamsilverstein@…, dh-shredder |
Description
I noticed that simply loading and saving a post creates a new revision. This seems rather dumb to me. Could we not load the post up, compare it with the revision, and not create a whole new revision if nothing changed (ignoring post save time, of course)?
Discuss.
Attachments (8)
Change History (37)
- Summary changed from Don't create new revision if nothing changed to Don't create new autosave revision if nothing has changed yet
comment:2
navjotjsingh — 5 years ago
- Milestone changed from 2.9 to 2.8
- Keywords needs-patch added
- Milestone changed from 2.8 to Future Release
- Component changed from General to Autosave
- Owner anonymous deleted
comment:5
caesarsgrunt — 4 years ago
- Severity changed from normal to minor
- Type changed from enhancement to defect (bug)
+1 to this. I'm guessing it would be fairly easy to fix, though I haven't investigated.
see also #9843
comment:7
AmbushCommander — 3 years ago
- Cc AmbushCommander added
comment:8
solarissmoke — 2 years ago
- Keywords has-patch needs-testing added; needs-patch removed
This patch prevents revisions being created if the content hasn't changed. I think it should resolve #9843 as well.
solarissmoke — 2 years ago
- Cc kurtpayne added
- Keywords 3.6-early added
comment:10
westi — 4 months ago
- Keywords revisions-3.6 autosave-redo added
Maybe a candidate for investigation and resolution during the autosave/revision work in 3.6.
http://make.wordpress.org/core/2013/01/19/autosave-and-post-locking/
comment:11
SergeyBiryukov — 4 months ago
- Keywords revisions-3.6 removed
- Milestone changed from Future Release to 3.6
comment:12
follow-up:
↓ 13
SergeyBiryukov — 4 months ago
- Component changed from Autosave to Revisions
comment:13
in reply to:
↑ 12
westi — 4 months ago
- Component changed from Revisions to Autosave
Replying to SergeyBiryukov:
I left this in Autosave as it is an Autosave issue not a revisions issue.
comment:14
follow-up:
↓ 15
azaozz — 4 months ago
This happens only when the Visual editor is default (is shown first). Caused by running the post_content through wpautop before outputting it in the textarea (TinyMCE needs the <p>), so the first autosaveLast (used to determine if something has changed) gets post_content with <p> and is later compared to post_content without <p>.
There are better ways to do that, should be fixed with the autosave updates in 3.6.
comment:15
in reply to:
↑ 14
adamsilverstein — 4 months ago
Replying to azaozz:
This happens only when the Visual editor is default (is shown first). Caused by running the post_content through wpautop before outputting it in the textarea (TinyMCE needs the <p>), so the first autosaveLast (used to determine if something has changed) gets post_content with <p> and is later compared to post_content without <p>.
There are better ways to do that, should be fixed with the autosave updates in 3.6.
i've noticed this doesn't get fired on new posts if i create a post and publish it with just a title without entering any content.
in addition to the extra autosave, this winds up creating an extra revision, so creating a post with title and content starts out with two revisions, the 1st one is title only, the 2nd has title and content. thats confusing to users - see #9843. the current patch seems to do too much by checking for duplication, can we just check for the initial state you mention and skip the first and only the first autosave?
going to test the current patch anyway.
adamsilverstein — 4 months ago
comment:17
nacin — 4 months ago
This is also something we noticed while doing #22687.
- Cc adamsilverstein@… added
comment:19
dh-shredder — 4 months ago
- Cc dh-shredder added
comment:20
markjaquith — 3 months ago
- Owner set to westi
- Status changed from new to assigned
Assigning to westi — can you take another look?
comment:21
westi — 3 months ago
In 1211/tests:
comment:22
westi — 3 months ago
- Resolution set to fixed
- Status changed from assigned to closed
In 23414:
comment:23
westi — 3 months ago
In 1214/tests:
comment:24
westi — 3 months ago
In 23415:
comment:25
azaozz — 2 months ago
dont-save-autosave.diff won't work as expected (and has a copy/paste typo, $new_data is not defined in wp_create_post_autosave()).
It only checks whether the autosave is the same as the current post when a previous autosave exists. To catch the first autosave, perhaps we can move the test for changed fields from wp_save_post_revision() to _wp_put_post_revision(). We will still need the same test in wp_create_post_autosave() for the cases when an autosave is updated.
comment:26
follow-up:
↓ 27
azaozz — 2 months ago
Alternatively something like 7392-autosave.patch should work.
comment:27
in reply to:
↑ 26
adamsilverstein — 2 months ago
Replying to azaozz:
Alternatively something like 7392-autosave.patch should work.
thanks, that looks good. do we still need the check in _wp_put_post_revision as well? will try testing this patch.
comment:28
nacin — 7 weeks ago
- Resolution fixed deleted
- Status changed from closed to reopened
Re-opening due to remaining patches.
comment:29
adamsilverstein — 2 weeks ago
in 7392.2.diff:
- add duplicate content check in wp_create_post_autosave, refreshed from 7392-autosave.patch
- note that if "revisioned fields" (by default: title, content, excerpt) are unchanged, autosaves will not fire, even if you change revisioned post_meta such as post format. (also true of regular update revisions)

Additional: I worded that badly.
What I mean is that when I load a post up and wait for the autosave, I get the autosave revision there, and future loads of that post tell me that there's a newer autosave, even though nothing has changed with the post.
Can we disable autosave until something actually changes in the post?