Disable WordPress Autosave and Revisions

      No Comments on Disable WordPress Autosave and Revisions

Autosave: WordPress automatically saves your posts, pages, or custom post types as drafts while you are editing them. This feature helps prevent loss of work in case of accidental browser closures, system crashes, or any other interruptions. The autosave feature periodically saves your content in the background, ensuring that you can recover your work if something unexpected happens while you’re editing.

Revisions: WordPress keeps a history of changes made to posts, pages, and custom post types. Each time you save a draft or update a published piece of content, WordPress creates a new revision. Revisions allow you to track changes over time and revert to earlier versions if needed. You can compare different revisions to see what changes were made, and you have the option to restore an older version if you decide to undo recent edits.

Method 1: Using Code

Disable Autosave:

Add the following code to your theme’s functions.php file:

add_action('admin_init', 'disable_autosave');
function disable_autosave() {
    wp_deregister_script('autosave');
}

This code will prevent the autosave script from loading in the WordPress admin area.

Limit Revisions:

Add the following code to your wp-config.php file:

define('WP_POST_REVISIONS', false);

This code will disable post revisions completely. If you want to limit the number of revisions rather than disabling them entirely, you can set a specific number instead of false. For example:

Add the following code to your wp-config.php file:

define('WP_POST_REVISIONS', 3); // Limit to 3 revisions

 

Method 2: Using a Plugin

How to install a plugin

Alternatively, you can use a plugin like “Disable Post Revision” to easily manage autosave and revision settings without needing to touch any code.

  1. Install and activate the “Disable Post Revision” plugin from the WordPress plugin repository.
  2. Once activated, go to Settings ยป Writing in your WordPress admin area.
  3. Scroll down to the “Disable Post Revisions” section and check the box labeled “Disable post revisions.”
  4. Save your changes.

Using either of these methods, you can effectively disable autosave and revisions in WordPress to suit your preferences. Remember to backup your site before making any significant changes, especially if you’re modifying theme files or using plugins.

Leave a Reply

Your email address will not be published. Required fields are marked *