# Stop WPForms Emails on Staging Sites

> Turns off all WPForms notification emails when the site is not running as production, so test submissions on staging never reach clients.

- Type: PHP
- Runs: Run everywhere
- Category: [Forms](https://wpide.com/library/category/forms/)
- Tags: wpforms, notifications, staging
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/wpforms-disable-emails-staging/

## Code

```php
add_filter( 'wpforms_disable_all_emails', function ( $disabled ) {
    return 'production' !== wp_get_environment_type() ? true : $disabled;
} );
```

## Notes

Relies on WP_ENVIRONMENT_TYPE being set to staging, development or local on non-live copies.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Stop WPForms Emails on Staging Sites" 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/
