Support

Account

Home Forums Feature Requests Return acf_form instead of echo

Solved

Return acf_form instead of echo

    • macdp

    • December 1, 2020 at 10:23 pm

    Hey ACF

    I must admit that I have not looked through all of the feature requests, so I don’t know if someone else have have suggested this, but…

    The issue I’m having is that I’m creating an ACF form on front-end using acf_form().
    It’s great, but the issue is that I’m creating the form in a custom made shortcode.
    The form is created, but when I include the shortcode on a page, the form is placed at the very top of the page content, and not at the given place in the page content where I inserted the shortcode.

    The issue likely occurs because acf_form() immediately creates the content when called, since it echos the form and the form’s content.

    Is it possible to make a feature where you can pass a parameter to acf_form(), and the form will be returned by the function, rather than just immediately creating it?

  • 
    ob_start();
    acf_form(...);
    return ob_get_clean();
    
    • macdp

    • December 3, 2020 at 1:38 am

    thanks for reply 🙂
    I just found out about that solution, but thanks anyway ^_^

  • How to echo on same html page after form submit?

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