# Site Health Check for Must-Have Plugins

> Adds a test to Tools > Site Health that turns critical when any plugin you list as essential, such as your backup, security or SEO plugin, is deactivated or missing.

- Type: PHP
- Runs: Run everywhere
- Category: [Developer](https://wpide.com/library/category/developer/)
- Tags: site-health, plugins, monitoring
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/site-health-required-plugins/

## Code

```php
// Plugins that must stay active (folder/main-file.php => name).
$wpide_required_plugins = array(
    'wordfence/wordfence.php'         => 'Wordfence Security',
    'updraftplus/updraftplus.php'     => 'UpdraftPlus Backups',
);

add_filter( 'site_status_tests', function ( $tests ) use ( $wpide_required_plugins ) {
    $tests['direct']['wpide_required_plugins'] = array(
        'label' => 'Essential plugins are active',
        'test'  => function () use ( $wpide_required_plugins ) {
            if ( ! function_exists( 'is_plugin_active' ) ) {
                require_once ABSPATH . 'wp-admin/includes/plugin.php';
            }

            $missing = array();
            foreach ( $wpide_required_plugins as $file => $name ) {
                if ( ! is_plugin_active( $file ) ) {
                    $missing[] = $name;
                }
            }

            $result = array(
                'label'       => 'All essential plugins are active',
                'status'      => 'good',
                'badge'       => array( 'label' => 'Maintenance', 'color' => 'blue' ),
                'description' => '<p>The plugins this site depends on are installed and active.</p>',
                'test'        => 'wpide_required_plugins',
            );

            if ( $missing ) {
                $result['label']       = 'Essential plugins are inactive';
                $result['status']      = 'critical';
                $result['badge']['color'] = 'red';
                $result['description'] = '<p>These plugins should always be active: ' . esc_html( implode( ', ', $missing ) ) . '.</p>';
                $result['actions']     = '<a href="' . esc_url( admin_url( 'plugins.php' ) ) . '">Go to Plugins</a>';
            }

            return $result;
        },
    );

    return $tests;
} );
```

## Notes

List plugin paths as folder/main-file.php in $wpide_required_plugins.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Site Health Check for Must-Have 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/
