Support

Account

Home Forums General Issues How to fill acf field with $_post

Solving

How to fill acf field with $_post

  • Hi,

    My php skills are basic and I will be glad to get some help with one custom form. I have acf field in the backend and it’s working great. I want to implement the same field in front end form. I created the html field and set the variables. Can you give me directions what I should put in my form processing script? I tried with update_post_meta($post_id,’date’, $date); but without luck. My ACF field name is date.
    $date is holding the selected date.

    Regards

  • Hi @delx

    I need more to go on.
    Please describe your setup a bit more clearly and what you’re actually trying to achieve 🙂

  • Hi,

    Sorry for the unclear description. So I have installed AFC plugin and created a custom field from type datepicker. I assigned this field to posts. I have custom new post form which users with specific permissions can submit when they login. The custom field currently is available only for the admins who create new post from the WP admin panel. I want to make the custom field available in my front end submit new post page too. Is there any way to attach the custom field as additional field into my current form ? I hope this make sense.

    Regards

  • Hi @delx

    Thanks for the clarification!
    So your new post form, are you using acf_form() for this or is it something you’ve put together yourself?
    http://www.advancedcustomfields.com/resources/acf_form/

    If it’s a custombuilt form maybe think about switching to acf_form() as you’d get all and any fields attached to the post type automatically and everything “just works” 🙂

  • Unfortunately I have custom functionality that I’m afraid is not possible to use with ACF. Is there way to use the custom field without switching the whole form to acf_form() ?

  • Hi,

    Okay I see..
    You can actually use the acf_form() function within your own form by setting the form parameter to false.

    Then you can also set either which specific fields or specific field groups you want to include.

    So you should be able to keep your own setup while still using acf_forms simplicity 🙂 Have a look at the parameters found on the link i posted above.

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘How to fill acf field with $_post’ is closed to new replies.