Blog / WordPress/ How to Disable WordPress Auto-Save and Post Revisions (No Plugin Method)

How to Disable WordPress Auto-Save and Post Revisions (No Plugin Method)

WordPress 如何禁用自动保存与文章修订版本(无插件方法)

How to Disable WordPress Auto-Save and Post Revisions (Without Plugins)

This guide explains how to disable WordPress's auto-save and post revision features by modifying core files. Important: Directly editing core files is risky and changes will be overwritten during updates. Use these methods only in development or when absolutely necessary. For production sites, consider using a dedicated optimization plugin instead.

How It Works & Precautions

WordPress auto-save and revisions prevent content loss but can create redundant data for stable sites with infrequent edits. You can disable them via configuration and code edits.

Warning: Always back up files before modifying them. These steps are based on recent WordPress versions; adjust if file paths or code differ.

Step 1: Modify wp-config.php

In your WordPress root directory, open wp-config.php. Before the line /* That's all, stop editing! Happy publishing. */, add:

define('WP_POST_REVISIONS', false);
define('AUTOSAVE_INTERVAL', 86400); // Seconds (24 hours)

Explanation:

  • define('WP_POST_REVISIONS', false); – Completely disables post revisions.
  • define('AUTOSAVE_INTERVAL', 86400); – Sets auto-save interval to 24 hours, drastically reducing frequency. To disable entirely, set to a very high value, but Step 2 may still be needed.

Step 2: Disable Auto-Save Script (If Needed)

If auto-save remains active, comment out its script in these files:

  • wp-admin/post-new.php
  • wp-admin/post.php

Find lines containing wp_enqueue_script('autosave'); and comment them:

// wp_enqueue_script('autosave');

Step 3: Disable Auto-Draft Creation (Advanced)

WordPress creates an "auto-draft" when opening the post editor. To stop this, edit wp-admin/includes/post.php.

Find the wp_write_post() function or search for if ( $create_in_db ) {. Before that line, add:

$create_in_db = false;

Caution: This is a deep modification that may affect post creation. Test thoroughly.

Alternative: Use Plugins

For most users, plugins are safer and easier to maintain. Recommended options:

  • Disable Post Revision
  • Revision Control
  • WP Performance Score Booster

These plugins safely control revision limits and auto-save intervals, and remain compatible with updates.

Summary

You can disable auto-save and revisions by editing wp-config.php and core scripts without plugins. However, core modifications are risky and temporary. For live sites, using a trusted plugin is the recommended approach.

Post a Comment

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