Add a Static Choice

Instructions

Code

Filename: gppa-add-static-choice.php

<?php
/**
 * Gravity Perks // Populate Anything // Add a Static Choice
 * https://gravitywiz.com/documentation/gravity-forms-populate-anything/
 *
 * Instruction Video: https://www.loom.com/share/e425398f584148f58fdfea3d6b6f969b
 *
 */
add_filter( 'gppa_input_choices_123_4', function( $choices, $field, $objects ) {

	array_unshift( $choices, array(
		'text'       => 'My Static Choice',
		'value'      => 'static',
		'isSelected' => false,
	) );

	return $choices;
}, 10, 3 );

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.