2

I've got a custom post type for contact form submissions. I'm using the JSON API, so these form submissions get posted directly to WordPress.

I've got it to display custom meta columns (e.g. first name, last name, email address) in the admin, however I now need it to show these columns in the edit page.

Note, I only need to output these columns, not have them displayed in form fields.

How do I do this?

1 Answer 1

3

I found the answer:

add_action('add_meta_boxes', 'add_contact_form_meta_box');

function add_contact_form_meta_box() {
    add_meta_box('contact-form-meta-box-id', 'Submission Data', 'contact_form_meta_box', 'contact_form', 'normal', 'high');
}

function contact_form_meta_box($post) {
    echo get_post_meta($post->ID, 'first_name', true);
}
1
  • But don't you need to save them before you call get_post_meta?
    – A.Ahmad
    Commented Aug 10, 2017 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.