V
V
vad1mmm2021-12-13 11:29:22
WordPress
vad1mmm, 2021-12-13 11:29:22

How to assign a value to a hidden field?

I have a WordPress site. There is a form with a product card, when filled out, the data is sent to the mail. It has hidden fields, how can I add values ​​for these hidden fields that are in my variable? For example, my field key is: hidden_price And there is also this code, but I don't know how to do it

add_filter( 'ninja_forms_render_default_value', 'my_change_nf_default_value', 10, 3 );
function my_change_nf_default_value( $default_value, $field_type, $field_settings ) {
  if( 'textbox' == $field_type ){
    $default_value = 'foo';
  }
  return $default_value;
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question