Title: Form Submit Post, Exclude Fields
Last modified: December 19, 2023

---

# Form Submit Post, Exclude Fields

 *  Resolved Anonymous User 13711045
 * (@anonymized-13711045)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/form-submit-post-exclude-fields/)
 * I have a form which updates a post. On some occasions, I need it to not update
   certain fields. I see that the ‘acfe/form/prepare/post’ filter allows us to stop
   the form action completely, but how do I stop specific fields from updating?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Konrad Chmielewski](https://wordpress.org/support/users/hwk-fr/)
 * (@hwk-fr)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/form-submit-post-exclude-fields/#post-17309031)
 * Hello,
 * Thanks for the feedback!
 * The best way to update some fields programmatically, based on some condition,
   is to handle this logic from code.
 * Instead of selecting which ACF fields to update from the Post Action in the Form
   UI, you’ll have to update them via `update_field()` ([see documentation](https://www.advancedcustomfields.com/resources/update_field/))
   in the `acfe/form/submit/post` hook ([see documentation](https://www.acf-extended.com/features/modules/dynamic-forms/post-action#submit)),
   if you’re creating/updating a post, and add your condition there.
 * Usage example:
 *     ```wp-block-code
       add_action('acfe/form/submit/post/form=my-form', 'my_form_submit', 10, 5);
       function my_form_submit($post_id, $type, $args, $form, $action){
   
           // get the form input values (unformatted)
           $my_text = get_field('my_text', false, false);
           $my_email = get_field('my_email', false, false);
   
           // custom condition example
           // add your own logic here
           $should_update = true;
   
           // check our condition
           // fields should be updated?
           if($should_update){
   
               // update fields programmatically
               // on the creapted/updated post: $post_id
               update_field('my_text', $my_field, $post_id);
               update_field('my_email', $my_email, $post_id);
   
           }
   
       }
       ```
   
 * Hope it helps!
 * Have a nice day, and a happy holiday season!
 * Regards.
 *  Thread Starter Anonymous User 13711045
 * (@anonymized-13711045)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/form-submit-post-exclude-fields/#post-17312900)
 * In the section where I can grab the form inputs using get_field, are the values
   passed to that sanitized already? Or is it just the raw input?
 *  Plugin Author [Konrad Chmielewski](https://wordpress.org/support/users/hwk-fr/)
 * (@hwk-fr)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/form-submit-post-exclude-fields/#post-17383060)
 * Hello,
 * Yes, in this section, values are already sanitized (and validated via ajax too).
 * Regards.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Form Submit Post, Exclude Fields’ is closed to new replies.

 * ![](https://ps.w.org/acf-extended/assets/icon-256x256.png?rev=2071550)
 * [Advanced Custom Fields: Extended](https://wordpress.org/plugins/acf-extended/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/acf-extended/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/acf-extended/)
 * [Active Topics](https://wordpress.org/support/plugin/acf-extended/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/acf-extended/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/acf-extended/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Konrad Chmielewski](https://wordpress.org/support/users/hwk-fr/)
 * Last activity: [2 years, 4 months ago](https://wordpress.org/support/topic/form-submit-post-exclude-fields/#post-17383060)
 * Status: resolved