Support

Account

Home Forums Front-end Issues Render an ACF Form

Helping

Render an ACF Form

  • Okay, I need to render an ACF form and NOT have ACF process the input.

    In the form-front.php file I discovered the acf_render_fields() function and I created this function for rendering a form:

    function acf_render_fields_html( $post_id, $label = '-top', $instructions = 'field' ) {
        $fields = get_field_objects( $post_id );
        ob_start();
        acf_render_fields( $fields, $post_id, 'div', $instructions );
        $form = ob_get_contents();
        ob_end_clean();
        return '<div class="acf-fields acf-form-fields "' . $label . '>' . $form . '</div>';     
    }

    It does render the form, however it doesn’t fill in the values for existing form data in groups.

    It’s a work in progress, I’ll get it figured out, but if anyone else has already figured it out, I’d appreciate some help.

  • Does anyone know of an internal function to load the values from a post into a form?

Viewing 2 posts - 1 through 2 (of 2 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.