Support » Fixing WordPress » form to post multiple inputs into post_content

  • I have a form, with multiple inputs that I am trying to get posted to the wordpress “post_content”. I am able to get the title field and only one other field to post successfully, only when making a field name “description” instead of “description[]”, but have no idea how I can get the rest to submit into the post_content. I would like the inputs posted like the image I have created below.

    Here is the code I currently have that works for the title only.

    <?php /* Template Name: Question Form */ ?>

    if( ‘POST’ == $_SERVER[‘REQUEST_METHOD’] && !empty( $_POST[‘action’] ) && $_POST[‘action’] == “new_post”) {
    if (isset ($_POST[‘title’])) {
    $title = $_POST[‘title’];
    } else {
    echo ‘Please enter a title’;
    if (isset ($_POST[‘description’])) {
    $description = $_POST[‘description’];
    } else {
    echo ‘Please enter the content’;
    $tags = $_POST[‘post_tags’];
    $new_post = array(
    ‘post_title’ => $title,
    ‘post_content’ => $_POST[‘description’],
    ‘post_parent’ => 599,
    ‘post_status’ => ‘publish’,
    ‘post_type’ => ‘topic’
    $topic_meta = array(
    ‘forum_id’ => $new_post[‘post_parent’]
    $topic_id = bbp_insert_topic($new_post, $topic_meta);
    wp_redirect(get_permalink($topic_id)); exit;

    <form id=”new_post” name=”new_post” method=”post” action=””>

    <p class=”question”><label>Title</label><input name=”title” type=”text”></p>

    <p class=”question”><label>Description</label><input name=”description[]” type=”text”></p>

    <p class=”question”><label>Your First Name</label><input name=”description[]” type=”text”></p>

    <p class=”question”><label>Your Last Name</label><input name=”description[]” type=”text”></p>

    <p align=”right”><input type=”submit” value=”Publish” tabindex=”6″ id=”submit” name=”submit” /></p>

    <input type=”hidden” name=”action” value=”new_post” />

    <?php wp_nonce_field( ‘new-post’ ); ?>


    I don’t know how to add the other fields to be a part of post_content.

    I have tried a few other things, but have been unsuccessful. I would appreciate any help very much!

  • The topic ‘form to post multiple inputs into post_content’ is closed to new replies.