Search code examples
wordpressgravity-forms-pluginwordpress-hook

Gravity forms unset fields dynamically


I'm successfully populating the Gravity form fields using "gform_pre_render " hook. now i need to remove few fields dynamically. I spend hours to looking into documentation and did google searches but no luck. Its really helpful if someone know how to unset fields in gravity form. Thanks in advance


Solution

  • Ok, i find solution to unset fields

    inside gform_pre_render hook we can unset fields like this

    if( $field->id == 7 ){
       unset ( $form['fields'][7] );
    }