0

On homepage I would like to insert form that collects client details and saves it to wordpress backend.

I was thinking to use custom_post_type

register_post_type('invoices',
        array(
            'labels' => array(
                'name' => __('Invoices'),
                'singular_name' => __('Invoice')
            ),
        'public' => true,
        'has_archive' => false,
        'supports' => array('title')
        )
    );
  1. How I remove ability to publish? and view post / slug forms? This invoices won't be published on homepage. So is there a way to make post_type private? I thought 'public' => false would do the trick, but this hides from dashboard.
  2. I would like to add fields, like name/email/type of service. Is the only way to do this by adding add_meta_box?
  3. How do I pass data from unauthenticated visitor on homepage to wordpress?
0

1) To hide it from front, use following configuration in your register_post_type args

'exclude_from_search' => false,
'publicly_queryable' => false,
'show_in_nav_menus' => false,

2) If you look for a smoother approach, i would recommend using Advanced Custom Fields plugin

3) You can set up custom form and use wp_insert_post()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy