1

When editing a post in the admin I see records being added to the database to document my changes (here is part of the hooks I'm logging):

...
http://local.dev/151-autosave-v1/ clean_post_cache
http://local.dev/151-autosave-v1/ transition_post_status
http://local.dev/151-autosave-v1/ save_post

Then when I click the "update" button and officially save my changes I see this:

...
http://local.dev/headers-page/ clean_post_cache
http://local.dev/headers-page/ clean_page_cache
http://local.dev/headers-page/ transition_post_status
http://local.dev/151-revision-v1/ clean_post_cache
http://local.dev/151-revision-v1/ transition_post_status
http://local.dev/151-revision-v1/ save_post
http://local.dev/headers-page/ save_post

So I get the idea that revisions/auto-saved posts are just to make sure you don't lose changes before you "update" the actual post object. Is this correct or does wordpress use any of the revision/autosave post data to build the actual post?

I want to know if I can ignore/delete $post->post_type == 'revision' without side effects to existing posts.

1 Answer 1

4

Revisions to me are useless and just fills up your db. It might be useful to others though.

Revisions are created each time a post is revised/updated. This just holds an archive/copy of the post before it was updated, and gives the user an option to restore the specific post to an earlier time. This works exactly like any system with a restore button. If you click the button, you can undo changes and set the system back to an earlier time.

Autosaves basically just saves a draft of the post you are currently busy writing in the editor. This basically works like an automatic save button that automatically saves the post every specified amount of time, in this case 60 seconds. It protects that you against loosing all your complete work in the case of power failures, system failures ,etc. An autosave gets overwritten whenever a new autosave is done, so they don't glog up your db with lots of unnecessary post data

You have options to shorten or increase the autosave times, and to completely inhibit post revisions or set a maximum amount of post revisions to keep. You can read all in this article in the codex: Revisions

You can remove all revisions without worrying loosing any data. The only thing that you will loose is that you will not be able to reset a post to an earlier time. But the choices is up to you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.