Support

Account

Home Forums Backend Issues (wp-admin) Function to make a form input turn into the value of a field

Unread

Function to make a form input turn into the value of a field

  • Hello there,

    I’m using ACF to create a CTP with two fields: Name and Phone.

    Meanwhile this, I have this form generated with QuForm plugin, with some fields: name, phone, subject, message, etc.

    And I have a CTP named “Evaluation Sheet”.

    I want to pass form fields to transform into the first CTP fields. Attach 1

    I made this function:

    ———————————————–
    add_filter(‘quform_post_process_1’, function (array $result, Quform_Form $form) {
    $title = $form->getValue(‘quform_1_3’);
    $content = $form->getValue(‘quform_1_9’);

    $post = array(
    ‘post_title’ => $title,
    ‘post_content’ => $content,
    ‘post_type’ => ‘ficha_de_avaliacao’,
    ‘post_status’ => ‘publish’,
    );

    wp_insert_post($post);

    return $result;
    }, 10, 2);
    —————————————————————-
    With this function, a new post on the CTP ficha_de_avaliacao (evaluation sheet) is created with title and content, only
    quform_1_3 and quform_1_9 refers to “name” and “message” fields on QuForm form.

    In this function, how can I reference ACF functions to grab a field and make an input value on my QuForm form turn into a value in an ACF field? att2

    Thanks!

Viewing 1 post (of 1 total)

The topic ‘Function to make a form input turn into the value of a field’ is closed to new replies.