Force Default Values on User Input Step

Code

Filename: gflow-force-default-values-on-user-input-step.php

<?php
/**
 * Gravity Forms // Gravity Flow // Force Default Values on User Input Step
 * https://gravitywiz.com/
 */
add_filter( 'gravityflow_field_value_entry_editor', function( $value, $field ) {
	// Update "123" to your form ID and "4" and "5" to field IDs that should be forced to use their default values.
	if ( $field->formId == 123 && in_array( $field->id, array( 4, 5 ) ) ) {
		$value = $field->get_value_default_if_empty( array() );
	}
	return $value;
}, 10, 2 );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.