Hidden InputFREE

Docs Fields Hidden Input

#Field Render

Display a hidden input allowing you to pass custom data to the current form. The field wrapper won’t be displayed.

#Field Settings

Setting nameDescription
ValueDefine a custom value

#Field Value

#Formatted Value

$hidden = get_field('hidden');

// my_value

#Unformatted Value

$hidden = get_field('hidden', false, false);

// my_value

#Custom Value

It is possible to change the field value using the acf/prepare_field hook. Note that the value will saved like any other custom meta. Usage example:

/**
 * acf/prepare_field/name=hidden
 * https://www.advancedcustomfields.com/resources/acf-prepare_field/
 */
add_filter('acf/prepare_field/name=hidden', 'my_acf_hidden');
function my_acf_hidden($field){
    
    $field['default_value'] = 'my_value';
    
    // or:
    $field['value'] = 'my_value';
    
    return $field;
    
}

To prevent the value from being saved as a custom meta, you can use the acf/update_value hook and return null. Usage example:

/**
 * acf/update_value/name=hidden
 * https://www.advancedcustomfields.com/resources/acf-update_value/
 */
add_filter('acf/update_value/name=hidden', 'my_acf_hidden_update', 10, 3);
function my_acf_hidden_update($value, $post_id, $field){
    
    return null;
    
}