Managing WordPress Revisions

WordPress revisions are kind of automatically taken backups of your wordpress post or page. This feature is very much useful if you lost your page content by mistake, or you couldn’t save your changes due to sudden restart etc.

wordpress-revisionsRevisions are automatically store for all the post types ( page, post, media and all the custom post types ). But by default this is visible only on default wordpress post types (page, post, medea etc). If you are defining a new post type, you will explicitly have to define the support of revisions.

Enable revisions for custom post types

Revisions are not enabled for custom post types by default. Hence enabling revisions should define for each custom post type. To do that ‘revisions’ should be added to ‘supports’ array of the custom post type args.

'supports' => array( 'title', 'editor', 'revisions' );

Limiting wordpress revisions

WordPress itself stores up-to 25 revisions per each post by default. Old revisions will be deleted automatically and new revisions will be stored. But we can define how many revisions we need wordpress to store for us. It can be done by adding bellow code on wp-config.php

define('WP_POST_REVISIONS', 3);

Comparing Revisions

To compare any reviews, just click on “Brows” link showed in the above screenshot and you will see a comparison. Two change which revision to be compared, you can slide the bar at the top. Newly added contents are marked in green and deleted content marked in red. See the picture bellow