# Reminder to Remove Inactive Plugins

> Shows administrators a gentle notice on the Dashboard and Plugins screens when plugins have been left inactive, since unused plugins still need updates and can be a security risk.

- Type: PHP
- Runs: Admin only
- Category: [Admin](https://wpide.com/library/category/admin/)
- Tags: plugins, maintenance, security
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/admin-inactive-plugins-reminder/

## Code

```php
// Plugins that may stay inactive (folder/main-file.php).
$wpide_inactive_allowed = array( 'hello.php' );

add_action( 'admin_notices', function () use ( $wpide_inactive_allowed ) {
    $screen = get_current_screen();
    if ( ! current_user_can( 'delete_plugins' ) || ! $screen || ! in_array( $screen->id, array( 'dashboard', 'plugins' ), true ) ) {
        return;
    }

    if ( isset( $_GET['wpide_dismiss_inactive'] ) && check_admin_referer( 'wpide_dismiss_inactive' ) ) {
        set_transient( 'wpide_inactive_dismissed_' . get_current_user_id(), 1, 30 * DAY_IN_SECONDS );
    }
    if ( get_transient( 'wpide_inactive_dismissed_' . get_current_user_id() ) ) {
        return;
    }

    if ( ! function_exists( 'get_plugins' ) ) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $inactive = array();
    foreach ( get_plugins() as $file => $data ) {
        if ( ! is_plugin_active( $file ) && ! in_array( $file, $wpide_inactive_allowed, true ) && ! is_plugin_active_for_network( $file ) ) {
            $inactive[] = $data['Name'];
        }
    }
    if ( ! $inactive ) {
        return;
    }

    printf(
        '<div class="notice notice-info"><p><strong>%d inactive plugin(s):</strong> %s. If you no longer need them, deleting them reduces maintenance and risk. <a href="%s">Review plugins</a> &middot; <a href="%s">Dismiss for 30 days</a></p></div>',
        count( $inactive ),
        esc_html( implode( ', ', array_slice( $inactive, 0, 8 ) ) . ( count( $inactive ) > 8 ? '...' : '' ) ),
        esc_url( admin_url( 'plugins.php?plugin_status=inactive' ) ),
        esc_url( wp_nonce_url( add_query_arg( 'wpide_dismiss_inactive', 1 ), 'wpide_dismiss_inactive' ) )
    );
} );
```

## Notes

Add plugins you keep inactive on purpose to $wpide_inactive_allowed; the notice can be dismissed for 30 days.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Reminder to Remove Inactive Plugins" 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/
