Hi again @joecam
This snippet should help. In the code?2910
?should be changed to your form ID and?number-1
?should be changed to your number field’s ID (need to change on multiple places).
add_action( 'forminator_before_form_render', 'wpmudev_number_field_value_form', 10, 5 );
function wpmudev_number_field_value_form( $id, $form_type, $post_id, $form_fields, $form_settings ) {
if ( 2910 == $id ) {
add_filter( 'forminator_field_number_markup', 'wpmudev_add_value_field_cpt', 10, 5 );
}
}
function wpmudev_add_value_field_cpt( $html, $id, $required, $placeholder, $value ) {
$meta_val = '';
if ( strpos( $id, 'forminator-field-number-1' ) !== false ) {
$meta_val = get_post_meta( get_the_ID(), 'your_meta_key', true );
$html = str_replace( 'name="number-1"', 'name="number-1" value="'.$meta_val.'"', $html );
}
return $html;
}
He is a guide on how to install mu-plugin:
https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins
Kind Regards,
Kris