├── Redirect code ├── set field to disabled with css class └── Base Code /Redirect code: -------------------------------------------------------------------------------- 1 | /* 2 | * populate_product_link_gf 3 | * 4 | * @function renders the acf field on the frontend in a gravity form field 5 | * @author Taylor Drayson 6 | * @since 20/01/22 7 | * @usage Replace 'your_parameter' with your gravity form field name 8 | * Also replace 'field_name' with acf field name for the post 9 | */ 10 | add_filter( 'gform_field_value_link', 'populate_product_link_gf' ); 11 | function populate_product_link_gf( $value ) { 12 | $id = get_the_id(); 13 | return get_field('product_redirect',$id); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /set field to disabled with css class: -------------------------------------------------------------------------------- 1 | add_filter( 'gform_field_css_class', function ( $classes, $field, $form ) { 2 | 3 | if ( $field->cssClass == 'read-only' ) { 4 | $classes .= ' gfield_readonly'; 5 | } 6 | 7 | return $classes; 8 | }, 10, 3 ); 9 | 10 | add_action( 'gform_enqueue_scripts', function ( $form, $is_ajax ) { 11 | 12 | ?> 13 | 21 |