Skip to content

Instantly share code, notes, and snippets.

@mikeselander
Created February 28, 2014 03:27
Show Gist options
  • Save mikeselander/9264627 to your computer and use it in GitHub Desktop.
Save mikeselander/9264627 to your computer and use it in GitHub Desktop.
This is an example of the gform_field_value function
/**
* Pre-populates a company ID into a Gravity Forms field from a GET variable
*
* @since 0.1.0
*
*/
add_filter('gform_field_value_company_id', 'company_id_population');
function company_id_population(){
// if we have the proper company GET variable - set the return variable
if ( $_GET['company_id'] ){
return $_GET['company_id'];
}
}
@sschat
Copy link

sschat commented Jan 28, 2015

be sure to check the 'allow dynamically populate' field for this field in the form itself
and give it the param-name (in this code-case) : company_id

(gform_field_value_company_id) in where company_id is the parameter you fill in

@mkormendy
Copy link

Still doesn't seem to work.

@deefuz
Copy link

deefuz commented May 21, 2023

You have to call a predefined "populate_XXX" function and not use another naming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment