The gform_disable_auto_update filter allows you to disable automatic updates in Gravity Forms.
Usage
add_filter('gform_disable_auto_update', 'your_custom_function');
function your_custom_function($disabled) {
// your custom code here
return $disabled;
}
Parameters
$disabled(bool): Set totrueto disable automatic updates, orfalseto enable them. Defaults to the inverse of thegform_enable_background_updatesoption.
More information
See Gravity Forms Docs: gform_disable_auto_update
Examples
Disable automatic updates
Disables automatic updates for Gravity Forms.
add_filter('gform_disable_auto_update', '__return_true');
Enable automatic updates
Enables automatic updates for Gravity Forms.
add_filter('gform_disable_auto_update', '__return_false');
Disable automatic updates based on a custom condition
Disable automatic updates only when a specific condition is met.
add_filter('gform_disable_auto_update', 'disable_updates_on_condition');
function disable_updates_on_condition($disabled) {
if (your_custom_condition()) {
$disabled = true;
}
return $disabled;
}
Disable automatic updates for specific user roles
Disable automatic updates for users with a specific role.
add_filter('gform_disable_auto_update', 'disable_updates_for_role');
function disable_updates_for_role($disabled) {
if (current_user_can('your_specific_role')) {
$disabled = true;
}
return $disabled;
}
Log automatic update status changes
Log the automatic update status when it changes.
add_filter('gform_disable_auto_update', 'log_update_status_changes', 10, 1);
function log_update_status_changes($disabled) {
if ($disabled) {
error_log('Gravity Forms automatic updates disabled.');
} else {
error_log('Gravity Forms automatic updates enabled.');
}
return $disabled;
}