Description
The gravitysmtp_feature_flag
allows developers to disable features in Gravity SMTP.
All features are enabled by default.
Usage
add_filter( 'gravitysmtp_feature_flag', 'your_function_name', 10 );
Parameters
- $enabled bool
True or False. Sets the feature to enabled or disabled. - $flag_name string
The feature name.
Available $flag_name
‘s:
mailchimp_integration
– Since 1.5.0email_open_tracking
– Since 1.5.0gravitysmtp_dashboard_app
– Since 1.4.0amazon_ses_integration
– Since 1.4.0gravityforms_entry_note
– Since 1.4.0wp_email_management
– Since 1.3.0
Examples
Enable All Features
add_filter( 'gravitysmtp_feature_flag', '__return_true' );
Disable All Features
add_action( 'plugins_loaded', function () {
add_filter( 'gravitysmtp_feature_flag', '__return_false', PHP_INT_MAX );
}, 99 );
Enable Specific Feature
add_filter( 'gravitysmtp_feature_flag', function( $enabled, $flag_name ) {
return $flag_name === 'feature_flag_name_here' ? true : $enabled;
}, 10, 2 );
Disable Specific Feature
add_action( 'plugins_loaded', function () {
add_filter( 'gravitysmtp_feature_flag', function ( $enabled, $flag_name ) {
return $flag_name === 'feature_flag_name_here' ? false : $enabled;
}, PHP_INT_MAX, 2 );
}, 99 );
Note: When disabling the feature flags, you must use the WordPress hook plugins_loaded
and PHP_INT_MAX
because the plugin internally uses the same approach to enable them.
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Since
This filter was added in Gravity SMTP 1.3.0
Source Code
This filter is located in Gravity_Forms\Gravity_SMTP\Feature_Flags\Feature_Flag_Repository::is_enabled() within the file includes/feature-flags/class-feature-flag-repository.php