Front-end edit form
-
I am trying to get a front-end form, i have adopted this code for my case:
https://github.com/WebDevStudios/CMB2-Snippet-Library/blob/master/front-end/cmb2-metabox-shortcode.phpI have some fields that have ‘on_front’ => false parameter set and for those fields the values saved before are cleared.
How to fix that the NOT used fields on the front get preserved?
$cmb->add_field( array( 'name' => __( 'Owner ID', 'theme-domain' ), 'desc' => __( 'Numbers only', 'msft-newscenter' ), 'id' => $prefix . 'owner_id', 'type' => 'text', 'on_front' => false, // Optionally designate a field to wp-admin only 'attributes' => array( 'type' => 'number', 'pattern' => '\d*', ), ) );I will set this field in admin or will write a function to automaticaly set it for me, but the main thing is that is hidden from user using the form
And the other question:
I have custom post type that uses WPs title, editor and thunbnail, how to get them to the front-end form, or is it better to create my custom fields in CMB2, that have the same purpose?I am new to CMB2 so I guess there be a lot more questions to come.
The topic ‘Front-end edit form’ is closed to new replies.