Post Revisions and Autosave

As you write and edit your posts and pages on WordPress, the changes you make are automatically saved every 60 seconds by default. In the Publish Module at the top left of the editor, you’ll see when the entry was last saved and can click Save to force the editor to save.

WordPress saves these post revisions in the database so you can restore them as needed. WordPress uses Ajax to auto-save revisions to the post as you edit. This is a great feature and is recommended. However you may not want to have them saved so often. If you are on a very slow Internet connection it can become annoying. You might prefer to have it save every 5 minutes or so.

How To

There is a setting in the wp-config.php file. This file is in the root of your site. Add the following lines to that file, if they don’t already exist.

/** Set the autosave interval. The default is 60 seconds. */
define('AUTOSAVE_INTERVAL', 300);

You can put these lines somewhere just above the line line that reads:

/** That's all, stop editing! Happy blogging.  */

You can also set the maximum number of post revisions in this same file or set it to no post revisions at all. The following lines of code demonstrate these two options. Add one of these lines to the wp-config.php file.

define('AUTOSAVE_INTERVAL', 300 ); // the number is in seconds
define('WP_POST_REVISIONS', false );  // no post revisions (not recommended)

The above code, will not delete your past revisions that are already saved in your database. To delete all previous revisions, you will need to visit PHPMyAdmin and run the following SQL query. This is only for people who need to reduce the size of their database due to size restrictions or speed up the website.

DELETE FROM wp_posts WHERE post_type = "revision";

How you edit the wp-config.php file? The easiest way I’ve found is to download and install FileZilla and use it to ftp to you site and go from there. There is no charge for FileZilla. You will need your credentials to log in to your host. Alternatively you could log into your host provider and use their tools. If you are using FileZilla you will need to enter three pieces of information to get a connection:

  • Host – enter your website URL with ftp at the beginning, like this:
  • Username – enter your ftp account username
  • Password – enter your password and press Enter

The interface will look like two Windows Explorers side by side. The server is on the right hand side. Look under your web site folder to find wp-config.php. You can get a copy of it on your own computer by dragging the file to the left side. Now you can edit that with a text editor such as Notepad++. Save it on your computer and then drag it back to the right hand server side to upload it.