This must be the solution. I suppose I just need to learn how to implement this more. I don’t understand how to use this code properly. I’ve pasted a simplified version of the code I am calling with AJAX. If you can help me fill out the proper div and classes so that the code you gave me would work, that would be really nice. But I understand that all the resources are there and it’s really up to me to figure it out, so if not, that’s OK too. Thanks for the help.
<?php acf_form_head(); /* Template Name: pineditquote.php */ ?> <?php $post = get_post($_POST['id']); ?> <?php if ($post) : ?> <?php setup_postdata($post); ?> <div id="immediate_options_single_box" class="immediate_options_single_box"> <div id="io_form"> <?php $options = array( 'post_id' => $post->ID, // post id to get field groups from and save data to 'field_groups' => array(), // this will find the field groups for this post (post ID's of the acf post objects) 'form' => true, // set this to false to prevent the <form> tag from being created 'form_attributes' => array( // attributes will be added to the form element 'id' => 'post', 'class' => '', 'action' => '', 'method' => 'post', ), 'return' => add_query_arg( 'updated', 'true', get_permalink() ), // return url 'html_before_fields' => '', // html inside form before fields 'html_after_fields' => '', // html inside form after fields 'submit_value' => 'Update', // value for submit field 'updated_message' => 'Post updated.', // default updated message. Can be false to show no message ); acf_form( $options ); ?> </div> </div> <?php endif; ?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We've just released ACF 5.12.3 with a security fix to prevent arbitrary file uploads to forms with ACF fields.— Advanced Custom Fields (@wp_acf) July 14, 2022
Now that we've released this update, we recommend updating your sites as soon as possible.
© 2022 Advanced Custom Fields.