Post revisions, autosave, and trash handling

WordPress autosaves revisions of your posts and pages, and you can send
posts and pages to the trash can, instead of completely deleting them. You
visit the trash can and permanently delete your posts or pages. This extra
step is a safeguard in case of mistakes. (We give you the details about this
in Book IV.)

In terms of the post revisions, by default, WordPress saves unlimited revisions
and sometimes, depending on how often you edit and reedit posts and
pages, the saved revision list can get pretty long. You can limit the number
of revisions that WordPress will save by adding the following line to the
wp-config.php file:

define (‘WP_POST_REVISIONS’, 3); // limit number of revisions to 3

You can also completely disable the default revision feature by adding this
line to the wp-config.php file, on its own line:

define (‘WP_POST_REVISIONS’, false); // disable post revisions

WordPress creates these revisions through the Autosave feature. By default,
WordPress automatically saves a post revision every minute. If you take a
long time to write a post, you could rack up dozens of post revisions, which
are stored in the database and take up room. You can change the autosave
interval by adding this code to the wp-config.php file on its own line (this
code changes the autosave interval to 160 seconds, specifically — you can
choose any time interval you want):

define (‘AUTOSAVE_INTERVAL’, 160); // in seconds

The Trash feature in WordPress gives you a safeguard against permanently
deleting posts by mistake. In Book IV, you find that you can send a post or a
page to the trash and that this action doesn’t permanently delete it; instead,
WordPress stores it in a virtual trash can. (Windows users can think of it
as the Recycle Bin.) You can visit the trash can any time and permanently
delete the post or page, or you can leave it there and WordPress automatically
empties the trash can every 30 days. If you want to adjust this time
interval, you can add the first line of code to force WordPress to empty the
trash weekly, or the second line to disable the trash feature, completely, as
follows (on its own line):

define(‘EMPTY_TRASH_DAYS’, 7); // empty trash weekly
define(‘EMPTY_TRASH_DAYS’, 0); // disable trash

Advertisements
Post revisions, autosave, and trash handling

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s