Title: Front-end edit form
Last modified: August 31, 2016

---

# Front-end edit form

 *  Resolved [vrhovc](https://wordpress.org/support/users/vrhovc/)
 * (@vrhovc)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/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.php](https://github.com/WebDevStudios/CMB2-Snippet-Library/blob/master/front-end/cmb2-metabox-shortcode.php)
 * I 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.
 * [https://wordpress.org/plugins/cmb2/](https://wordpress.org/plugins/cmb2/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [10 years, 1 month ago](https://wordpress.org/support/topic/front-end-edit-form/#post-7210209)
 * trying to make sense of the first question.
 * It sounds like you have a mix of sources for where information will come from.
   Some will be set via the frontend form, some will be set via the admin. If I’m
   reading right, you’re also sort of mixing when which fields are shown while keeping
   them all together?
 * I would look over [https://github.com/WebDevStudios/CMB2/wiki/Field-Types](https://github.com/WebDevStudios/CMB2/wiki/Field-Types)
   and [https://github.com/WebDevStudios/CMB2/wiki/](https://github.com/WebDevStudios/CMB2/wiki/)
   in general.
 * You’ll see that you can set default values for fields, which may help in what
   you’re trying to accomplish here.
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [10 years, 1 month ago](https://wordpress.org/support/topic/front-end-edit-form/#post-7210211)
 * For the second question, not sure how best to handle that one, as those are different
   areas in the database than the postmeta table which CMB2 works with.
 * Perhaps a better sense of what you’re trying to achieve overall at the moment
   would help give a better picture for me to work from.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Front-end edit form’ is closed to new replies.

 * ![](https://ps.w.org/cmb2/assets/icon.svg?rev=2866672)
 * [CMB2](https://wordpress.org/plugins/cmb2/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cmb2/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cmb2/)
 * [Active Topics](https://wordpress.org/support/plugin/cmb2/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cmb2/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cmb2/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/front-end-edit-form/#post-7210211)
 * Status: resolved