Disabling WordPress Auto-Save (PHP)

Estimated reading: 3 minutes 87 views

WordPress comes with a built-in auto-save feature that automatically saves drafts of your pages and posts as you work on them. While this can be useful as a safety net, it can sometimes cause unwanted behavior, such as:

  • Overwriting changes you didn’t intend to keep
  • Saving content before you’re ready
  • Overworking your server
  • Slowing down your website
  • Cache building up too quickly

If you’re a web designer or someone that works on websites frequently, then you’re probably aware what a relief the auto-save can be but be equally annoying.

For this reason, some site owners prefer to have full control over when their content is saved.

Fortunately, disabling auto-save in WordPress is straightforward and can be done by adding a small snippet of code to your theme. Whatever method you choose to use, it’s clean, lightweight, and easy to reverse whenever you decide you want the feature back. Simply add the follow these instructions to get started:

Code Snippet

function disable_autosave() {
    wp_dequeue_script('autosave');
}
add_action('wp_print_scripts', 'disable_autosave');

Where to Add This Code

Here are three easy options:

Option 1: Install WPCode Lite Plugin (recommended)

This is by far the safest method and is beginner friendly if you’re not used to editing theme files.

  1. Search for WPCode Lite plugin in your website dashboard.
  2. Install and activate the plugin.
  3. Go to Snippets > Add New.
  4. Give your snippet a name like “Disabling WordPress Auto-Save.”
  5. Paste the code above.
  6. Choose “Run snippet everywhere”.
  7. Choose PHP, not CSS or any other.
  8. Save and activate.

Option 2: Functions.php

We don’t advise this option unless you’re a developer or if you feel comfortable editing theme files:

  1. Paste the snippet at the bottom.
  2. Open your functions.php file.
  3. Save and upload if needed.

💡 Tip: Always use a child theme to avoid losing changes when your theme updates.

Option 3: Config.php (recommended)

Add this line to your wp-config.php file (found in your site’s root directory):

define('AUTOSAVE_INTERVAL', 86400);

This sets the auto-save interval to 24 hours (effectively disabling it). You can access wp-config.php via your File Manager or via SSH/FTP in your cPanel.

To access wp-config.php and add the code follow these steps:

  1. Log in to your hosting control panel or cPanel.
  2. Open File Manager.
  3. Navigate to your public_html folder or your website folder.
  4. Find the file named wp-config.php and right-click it, then select Edit.
  5. Before making any changes, it is recommended to download a backup copy of the file to your computer first.
  6. Scroll to the bottom of the file and look for this line: /* That’s all, stop editing! Happy publishing. */
  7. Add the code directly above that line.
  8. Click to save changes.
  9. Your changes will take effect immediately — no need to restart anything.

Option 4: Plugin

If you’d prefer not to touch code, install a plugin like Disable Autosave from the WordPress plugin directory — it does the job with no configuration needed.

However, it is advisable to not use a plugin when there are other viable options. The more plugins you have installed on your website, the greater the risk of conflicts, errors, site loading slow, or not loading at all.

Leave a Reply

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

Share this Doc

Disabling WordPress Auto-Save (PHP)

Or copy link

CONTENTS