# Turn Off Autosave for Chosen Post Types

> Stops the editor from autosaving the post types you list (for example products or custom data types edited by many people), which removes frequent background requests and extra autosave revisions.

- Type: PHP
- Runs: Admin only
- Category: [Performance](https://wpide.com/library/category/performance/)
- Tags: autosave, editor, admin
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/perf-disable-autosave-for-types/

## Code

```php
// Post types without autosave.
$wpide_no_autosave_types = array( 'product', 'shop_order' );

add_action( 'admin_enqueue_scripts', function ( $hook ) use ( $wpide_no_autosave_types ) {
    if ( ! in_array( $hook, array( 'post.php', 'post-new.php' ), true ) ) {
        return;
    }

    $screen = get_current_screen();

    if ( $screen && in_array( $screen->post_type, $wpide_no_autosave_types, true ) ) {
        wp_dequeue_script( 'autosave' );
    }
} );

add_filter( 'block_editor_settings_all', function ( $settings, $context ) use ( $wpide_no_autosave_types ) {
    if ( isset( $context->post->post_type ) && in_array( $context->post->post_type, $wpide_no_autosave_types, true ) ) {
        $settings['autosaveInterval'] = 86400;
    }

    return $settings;
}, 10, 2 );
```

## Notes

Unsaved changes are lost if the browser crashes, so only use it for post types where that is acceptable.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Turn Off Autosave for Chosen Post Types" 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/
