Stop Gravity Forms Notifications on Staging Sites
Turns off all Gravity Forms email notifications when the site is not the production environment, so tests on staging never email clients or your team.
Opens WPIDE on
Code
add_filter( 'gform_disable_notification', function ( $disabled ) {
return 'production' !== wp_get_environment_type() ? true : $disabled;
} );
Notes
Uses the WP_ENVIRONMENT_TYPE setting; set it to staging, development or local in wp-config.php on copies of the site.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.