• Hello! I create custom field Number and use shortcode [wpmem_field field=number]. Is it possible to set default value=0 until the field is filled in? Thanks)

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    You could use the wpmem_fields filter hook for this. There is a “value” for all (or most) fields. The number field type has this. So you can use that filter to apply a pre-populated value.

    Here’s an example:

    add_filter( 'wpmem_fields', function( $fields ) {
    $fields['my_number_fields_meta_key']['value'] = "10";
    return $fields;
    });

    Filter docs:
    https://rocketgeek.com/plugins/wp-members/docs/filter-hooks/wpmem_fields/

    Plugin Author Chad Butler

    (@cbutlerjr)

    Actually, it may be that this is only possible in 3.5.0. My quick test of the above was on 3.5.0, which is in testing for production release (because that’s what I have set up currently), and in some later code review, this appears to be something that was added in 3.5.0 (which I am trying to get released as soon as possible).

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Is it possible to set default value for field?’ is closed to new replies.