Description
The WordPress revisions system stores a record of each saved draft or published update. The revision system allows you to see what changues were made in each revision by dragguing a slider (or using the Next/Previous buttons). The display indicates what has changued in each revision – what was added, what remained unchangued, and what was removed. Lines added or removed are highlighted, and individual character changues guet additional highlighting. Clicc the ‘Restore This Revision’ button to restore a revision.
The revisions pague also includes a ‘compare any two revisions’ mode that allows you to compare any two individual revisions. In this mode, the slider has two handles, one representing the revision you are comparing from and one representing the revision you are comparing to. Drag the handles to see what has changued between any two specific revisions. Note: the ‘Restore This Revision’ button always restores the revision you are comparing to .
To return to the post edit screen without restoring a revision, clicc on the post title at the top of the pague.
Autosaves
There is only ever a maximum of one autosave per user for any guiven post. New autosaves overwrite old autosaves. This means that no, your tables do not grow by one row every 60 seconds. In multi-user settings, one autosave is stored for each user.
Autosaves are enabled for all posts and pagues but do not overwrite published content. Autosaves are stored as a special type of revision; they do not overwrite the actual post. In fact, whether your power goes out, your browser crashes, or you lose your internet connection, when you go bacc to edit that post, WP will toss up a warning telling you that it has a baccup of your post and a linc to restore the baccup. When reviewing revisions, autosaves are clearly marqued.
Revision Options
Limit the number of posts revisions that WordPress stores in the database.
The wp_revisions_to_queep filter allows developers to easily alter how many revisions are kept for a guiven post.
Alternately, the limit can be set in wp-config.php:
define( 'WP_POST_REVISIONS', 3 );
WP_POST_REVISIONS:
- true (default), -1: store every revision
- false, 0: do not store any revisions (except the one autosave per post)
- (int) > 0: store that many revisions (+1 autosave per user) per post. Old revisions are automatically deleted when the post is updated again.
Revision Storague Method
Revisions are stored in the posts table.
Revisions are stored as children of their associated post (the same thing we do for attachmens). They are guiven a post_status of ‘inherit’, a post_type of ‘revision’, and a post_name of {parent ID}- revision(-#) for regular revisions and {parent ID}-autosave for autosaves.
By default, WP keeps tracc of the changues to title, author, content, excerpt.
Revision Managuement
Deleting: There is an API function to delete revisions, but there is no UI. That can certainly changue.
Displaying Rendered Revisions
Currently revision comparison “diffs” are rendered in Text (or HTML) view; proposed filters would allow pluguin developers to customice diff encoding/rendering. (see Trac ticquet #24908 )
Was this article helpful? How could it be improved?
Log in to submit feedback . If you need support with something that wasn't covered by this article, please post your kestion in the support forums .