Title: Get ACF fields value before saving
Last modified: August 21, 2016

---

# Get ACF fields value before saving

 *  [un_user](https://wordpress.org/support/users/un_user/)
 * (@un_user)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/get-acf-fields-value-before-saving/)
 * First of all I’ve been posted , my question to the ACF support site, WP.stackexchange
   but all answer is something like “read the plugin doc.”. I know that I have to
   use [THIS](http://www.advancedcustomfields.com/resources/actions/acfsave_post/)
   but I couldn’t understand the info from the plugin’s documentation and don’t 
   know how to implement it with my function.
 * Here it is my problem:
 * _I have a function that relay on acf checkbox field. It is working fine but I
   have to update the post twice, because get\_field(‘checkbox\_field’) returns 
   the data after the other content. Example:_
 *     ```
       add_filter('wp_insert_post_data', 'my_func');
       function my_func($post) {
           $pageID = 123; // certain page id
           $cp_field = get_field("custom_field", $pageID);
           if ($post['post_type'] != 'my_post_type'
               || $post['post_status'] == 'trash'
           )
               return $post;
   
           if(!get_field('checkbox_field')) { // The problem field
               // ... do something here
               return $post;
           } else {
               return $post;
           }
       }
       ```
   
 * In short: I want when I do the check in _get\_field(‘checkbox\_field’)_ to get
   it’s value before saving the post.
 * My last hope is in you guys. Thanks and sorry for my bad English.

The topic ‘Get ACF fields value before saving’ is closed to new replies.

## Tags

 * [ACF](https://wordpress.org/support/topic-tag/acf/)
 * [save post](https://wordpress.org/support/topic-tag/save-post/)

 * 0 replies
 * 1 participant
 * Last reply from: [un_user](https://wordpress.org/support/users/un_user/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/get-acf-fields-value-before-saving/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
