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

    • vyctor

    • June 20, 2019 at 4:07 am

    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)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.