# Automatic Updates for the Plugins You Trust Most

> Turns on automatic background updates for the plugins you list (for example your security and backup plugins), so security fixes for them are installed within hours without waiting for you.

- Type: PHP
- Runs: Run everywhere
- Category: [Security](https://wpide.com/library/category/security/)
- Tags: updates, plugins, automation
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/sec-auto-update-chosen-plugins/

## Code

```php
// Plugin folder names (slugs) to update automatically.
$wpide_auto_update_slugs = array( 'wordfence', 'updraftplus', 'akismet' );

add_filter( 'auto_update_plugin', function ( $update, $item ) use ( $wpide_auto_update_slugs ) {
    $slug = isset( $item->slug ) ? $item->slug : ( isset( $item->plugin ) ? dirname( $item->plugin ) : '' );

    return in_array( $slug, $wpide_auto_update_slugs, true ) ? true : $update;
}, 20, 2 );
```

## Notes

Use plugin folder names as they appear in wp-content/plugins; all other plugins keep the setting chosen on the Plugins screen.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Automatic Updates for the Plugins You Trust Most" 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/
