# Change the Autosave Interval

> Autosaves drafts every two minutes instead of every minute, in both the block editor and the classic editor.

- Type: PHP
- Runs: Run everywhere
- Category: [Performance](https://wpide.com/library/category/performance/)
- Tags: performance, autosave, editor
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/autosave-interval/

## Code

```php
$wpide_autosave_seconds = 120;

if ( ! defined( 'AUTOSAVE_INTERVAL' ) ) {
    define( 'AUTOSAVE_INTERVAL', $wpide_autosave_seconds );
}

add_filter( 'block_editor_settings_all', function ( $settings ) use ( $wpide_autosave_seconds ) {
    $settings['autosaveInterval'] = $wpide_autosave_seconds;

    return $settings;
} );
```

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Change the Autosave Interval" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
